home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / sys / mac / programm / 18639 < prev    next >
Encoding:
Text File  |  1992-11-19  |  1.7 KB  |  46 lines

  1. Newsgroups: comp.sys.mac.programmer
  2. Path: sparky!uunet!mcsun!sunic!kth.se!hemul.nada.kth.se!d88-jwa
  3. From: d88-jwa@hemul.nada.kth.se (Jon WΣtte)
  4. Subject: Re: Access directory contents
  5. Message-ID: <1992Nov19.101822.22902@kth.se>
  6. Sender: usenet@kth.se (Usenet)
  7. Nntp-Posting-Host: hemul.nada.kth.se
  8. Organization: Royal Institute of Technology, Stockholm, Sweden
  9. References: <1992Nov16.131617.2096@ncsu.edu> <19385@ucdavis.ucdavis.edu>
  10. Distribution: comp.sys.mac.programmer
  11. Date: Thu, 19 Nov 1992 10:18:22 GMT
  12. Lines: 32
  13.  
  14. In <19385@ucdavis.ucdavis.edu> cklarson@burrito.engr.ucdavis.edu (Christopher Klaus Larson) writes:
  15.  
  16. >In article <1992Nov16.131617.2096@ncsu.edu> cpastore@unity.ncsu.edu (Chris Pastore) writes:
  17. >>
  18. >>Is there some easy way to get the listing of file names once a
  19. >>directory is identified?
  20. >>
  21.  
  22. >Call PBGetCatInfo on the directory: once with ioFDirIndex negative, to
  23. >obtain the number of files in the directory; then call it again, once for
  24. >each value of ioFDirIndex between 1 and the number of files in the
  25. >directory, inclusive. (I know this explination is not very clear, 
  26. >basically you are performing an indexed search of the directory.)
  27.  
  28. This is not generally the best way, since files may be added
  29. or removed while you do it. Instead, just start enumerating
  30. from 1 and up in indexed mode. Don't give up on the first error,
  31. it might be a permission error, give up first when you get a fnfErr
  32. (or was that eofErr?)
  33.  
  34. Actually, you still might have problems with disappearing files
  35. (or appearing files) so you might want to go back and check again
  36. like DIsinfectant does it.
  37.  
  38. Cheers,
  39.  
  40.                         / h+
  41.  
  42. -- 
  43.  -- Jon W{tte, h+@nada.kth.se, Mac Hacker Suedoise (not french speaking) --
  44.    This signature is kept shorter than 4 lines in the interests of UseNet
  45.    S/N ratio.
  46.