🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: alt.msdos.programmer
5 messages
5 total messages Started by MARC VEILLEUX Mon, 16 Mar 1992 05:19
C questions (intermediate?)
#1125
Author: MARC VEILLEUX
Date: Mon, 16 Mar 1992 05:19
11 lines
982 bytes
Here a some C questions :
HOw can you tell if a file is already in use (like in windows)?
HOw can you flush the keyboard buffer?
What's is the fastest way to delete all file in current dir?

Thanx for your time.
-- 
+--------------------------+---------------------------------------------------+
|Max Halen                 |"Ain't nothing like MAPLE syrup!" - Max Halen      |
|Max@punisher.Sherb.CAM.ORG|"If you're guilty, you gotta die" - The Punisher   |
|veilm00@DMI.USherb.CA     |"I love my baby POUNDCAKE";       - Van Halen      |
Re: C questions (intermediate?)
#1126
Author: Glynn Brooks
Date: Mon, 16 Mar 1992 19:02
22 lines
1145 bytes
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)?
>HOw can you flush the keyboard buffer?
>What's is the fastest way to delete all file in current dir?

Here is an answer to your second question:

#define HEAD *(int far *)MK_FP(0x40, 0x1a))
#define TAIL *(int far *)MK_FP(0x40, 0x1c))

	HEAD = TAIL;	// Flush keyboard buffer

This routine works by resetting the head pointer (offset) to the same
value as the tail pointer, which by definition, means the buffer is
empty.
-- 
Glynn Brooks            Internet: rgb@mitek.com				
OpenConnect Systems     CompuServe: 76326,502
2033 Chennault Dr.
Carrollton, TX 75006
Re: C questions (intermediate?)
#1127
Author: Stephen A. Weatherford
Date: Tue, 17 Mar 1992 20:29
25 lines
1211 bytes
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....

>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
PLEASE MOVE TO THE DICSUSSION GROUPS (WAS Re: C questions (intemredi))
#1128
Author: Eric A. Litman
Date: Tue, 17 Mar 1992 21:53
16 lines
1551 bytes
Please retain any and all materials that are NOT specifically source code
(i.e. requests for code, discussions of code, programming questions in
general) from this newsgroup. Many sites archive this group, and must go
through extra, unnecessary work to weed out all of the exterraneous postings.
In addition, this is simply not the place. There is an alt.sources.d for 
discussion, alt.sources.wanted for those looking for code, as well as
programming newsgroups that specifically deal with the questions recently
posed here in alt.sources.

I apologize for posting material not source related, but the "miscellaneous"
postings were numbering high.
-- 
 __                  
(        |          Internet: elitman@wam.umd.edu      | Whosoever shall be a |
 >       |          AT&TNet : 301-314-1923             | man must be a        |
(__ ric  |__ itman  ICBMnet : 38 58 50 N   76 54 14 W  | nonconformist.  -RWE |
Re: C questions (intermediate?)
#1129
Author: 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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads