home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / lang / c / 16772 < prev    next >
Encoding:
Text File  |  1992-11-18  |  2.3 KB  |  59 lines

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