🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.msdos.programmer
Article #1129

Re: C questions (intermediate?)

#1129
From: Don Krantz
Date: Wed, 18 Mar 1992 13:29
39 lines
1587 bytes
In <1992Mar17.202925.16262@csrd.uiuc.edu> weather@sp90.csrd.uiuc.edu (Stephen A. Weatherford) writes:

>veilm00@terre.DMI.USherb.CA (MARC VEILLEUX) writes:

>>Here a some C questions :
>>HOw can you tell if a file is already in use (like in windows)?

>Don't ask me....


Normally, this can't be done. A "lock" file is often used for this purpose 
(a lock file is another file whose existence signals some fact, but this
requires that all programs obey the convention of using that particular
lock file)

>>HOw can you flush the keyboard buffer?

>In Turbo C, simply:

>	while (kbhit())
>		getch();	/* while character in buffer, read it and
>					discard */

>>What's is the fastest way to delete all file in current dir?

>Well, it depends on what you mean by fast, I suppose (to program, or
>to execute....)

>If you're using Turbo C, you can look at the commands findfirst(),
>findnext() (which let you get the files in the directory) and unlink()
>(which deletes a file).

>Stephen A. Weatherford

If your library has a "system()" function, try this:

	system( "del *.*" );

Don
Technical Details
Message-ID: <1992Mar18.132954.9633@cs.umn.edu>
Path: arc1-ca.pugleaf.net!wupost!spool.mu.edu!umn.edu!cs.umn.edu!krantz
References: <1992Mar16.051932.18878@DMI.USherb.CA> <1992Mar17.202925.16262@csrd.uiuc.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!wupost!spool.mu.edu!umn.edu!cs.umn.edu!krantz
From: krantz@cs.umn.edu (Don Krantz)
Newsgroups: alt.msdos.programmer,alt.sources
Subject: Re: C questions (intermediate?)
Message-ID: <1992Mar18.132954.9633@cs.umn.edu>
Date: 18 Mar 92 13:29:54 GMT
Article-I.D.: cs.1992Mar18.132954.9633
References: <1992Mar16.051932.18878@DMI.USherb.CA> <1992Mar17.202925.16262@csrd.uiuc.edu>
Organization: University of Minnesota, Minneapolis, CSci dept.
Lines: 39