home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: sparky!uunet!portal!dfuller
- From: dfuller@portal.hq.videocart.com (Dave Fuller)
- Subject: Re: Reading Filenames into an ARRAY
- Message-ID: <BxxG1E.IvI@portal.hq.videocart.com>
- Organization: VideOcart Inc.
- X-Newsreader: Tin 1.1 PL3
- References: <1992Nov18.164544.13273@netcom.com>
- Date: Wed, 18 Nov 1992 19:41:38 GMT
- Lines: 47
-
- bobb@netcom.com (Bob Beaulieu) writes:
- : I want to be able to display a list of specific files in the current
- : directory from within my program. I want to be able to allow users to
- : select from a list of these file to be acted upon (printed,deleted,...).
- :
- : Is there an easy way to do this? It has to be DOS 2.0+ and not a
- : windows application.
- :
-
- DOS 2.0 ??? Pretty old.
-
- you can do this. you will have to build the functionality to pick the
- filename yourself though. there isn't any preset method for that.
- These functions exist in microsoft compilers, but i'm not so sure
- about any others. i believe also borland. If they don't exist as these
- names they probably exist in some form as a similar name. But, as i siad,
- i don't know.
-
- _dos_findfirst() - allows you to find the first file matching the
- requirements you give it.
- _dos_findnext() - finds the next file matching the requirements.
-
- Look these up in a manual, its the only way to really understand them.
- You use a structure (find_t) for both calls. The last selected file
- information is kept in the structure, so the findnext call knows where
- to continue looking in the path you specified.
-
- When you call _dos_findfirst you specify a path, a file spec (wildcards
- are accepted), and a file type to look for (normal, read-only, hidden,
- system, volume id, subdir, or archive). This returns the file info in the
- structure. Then when calling _dos_findnext() you pass it the structure
- it finds the next valid file, and returns it in the structure. You
- continue to use _dos_findnext() until you get a return value other than
- a 0.
-
- File information that is available from the structure:
- last time file was written to
- last date file was written to
- length of file in bytes
- file name
-
- Like I said, the reference will give a good, solid explanation. Mine is
- sketchy and doesn't give full syntax an usage notes.
-
- Dave Fuller
- dfuller@portal.hq.videocart.com
-
-