home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / os / msdos / programm / 8576 < prev    next >
Encoding:
Text File  |  1992-08-17  |  1.9 KB  |  44 lines

  1. Newsgroups: comp.os.msdos.programmer
  2. Path: sparky!uunet!gossip.pyramid.com!aquila.sni-usa.com!news.sni.de!fam168!frank
  3. From: Frank Hoffmann <fh.pad@sni.de>
  4. Subject: Re: Need help reading directory structures?
  5. Message-ID: <frank.714062035@fam168>
  6. Sender: news@nixpbe.sni.de
  7. Organization: Siemens Nixdorf Info.Sys. AG, Paderborn, Germany
  8. References: <Bszpyt.D5H@acsu.buffalo.edu>
  9. Date: Mon, 17 Aug 1992 14:33:55 GMT
  10. Lines: 32
  11.  
  12. millard@acsu.buffalo.edu (Peter G. Millard) writes:
  13.  
  14. >I was wondering what is the easiest way to check for and see
  15. >if input is a directory or file (is this possible via interrups or
  16. >something like them?)
  17.  
  18. >For example, at a prompt someone can type in either a filename
  19. >or a directory (to search). I need to distinguish between the two.
  20. >(ie. if they type in a filename, load the file...if it's a directory,
  21. >jump to another subroutine to search the path w/ specific file specs and 
  22. >show results in window,etc...)The problem I have is I don't know how
  23. >to ask the drive if the input is a file or a dir..
  24.  
  25. >Is there an easy way to do this?
  26.  
  27. Sure !
  28.  
  29. 1. Execute a _dos_findfirst() for that file. (Include all archive bits
  30.    _A_NORMAL|_A_RDONLY|_A_HIDDEN|_A_SYSTEM|_A_SUBDIR|_A_ARCH )
  31.  
  32. 2. Compare (find_t.attrib & A_SUBDIR). True ?? (>0), then it's a subdir!
  33.  
  34. frank
  35. -------------------------------------------------------------------------------
  36.     __________                  Frank Hoffmann
  37.      /             /    Siemens-Nixdorf Info. Systems Voice: [+49] 5251 812 209
  38.     /__           /      Dept: AP 52 / SW-Production    Fax: [+49] 5251 811 599
  39.    /' _  _   __  //            Fuerstenallee 7          USA: fh.pad@sni-usa.com
  40. __/__/__(_(_/ /_/^\__    W-4790 Paderborn / Germany    !USA: fh.pad@sni.de
  41. -------------------------------------------------------------------------------
  42. ( * )  <--- The green dot.  This mail is reusable. Copy to /dev/null instantly.
  43. -------------------------------------------------------------------------------
  44.