home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / sys / mac / hypercar / 2922 < prev    next >
Encoding:
Internet Message Format  |  1992-07-29  |  2.2 KB

  1. Path: sparky!uunet!comp.vuw.ac.nz!waikato.ac.nz!ldo
  2. From: ldo@waikato.ac.nz (Lawrence D'Oliveiro, Waikato University)
  3. Newsgroups: comp.sys.mac.hypercard
  4. Subject: Re: XCMD and filename HELP!!!
  5. Message-ID: <1992Jul30.173712.9751@waikato.ac.nz>
  6. Date: 30 Jul 92 17:37:12 +1200
  7. References: <1992Jul28.111201.21732@nuscc.nus.sg>
  8. Organization: University of Waikato, Hamilton, New Zealand
  9. Lines: 41
  10.  
  11. In article <1992Jul28.111201.21732@nuscc.nus.sg>, taihou@shankar.iss.nus.sg (Tng Tai Hou) writes:
  12. > Unfortunatelly, I run into some coding problems in manipulating
  13. > files. Internally, my code must require both the correct
  14. > vRefNum and a pascal filename:
  15. >
  16. > OSErr ShowTarga (short vRefNum, StringPtr fn, short x, short y);
  17. >
  18. > I really don't understand it at all. The only way I got this to
  19. > work was to follow exactly the following:
  20. >
  21. > 1.  Make sure that my folder or stack is 1 level in the hard disk and
  22. >     not anywhere else, including the desktop.
  23. > 2.  I must write my code such that vRefNum is zer0 for the default volume.
  24. > 3.  Then from HyperCard, I must specify the FULL path:
  25. >     "Volume:MyFolder:MyTargaFile"
  26. >
  27. > Is there a more generic way of writing this? I need both the vRefNum,
  28. > and the filename.
  29.  
  30. I take it you didn't write the ShowTarga routine. :-)
  31.  
  32. Apple's recommended way of referring to a file involves specifying three
  33. pieces of information:
  34.     * the volume refnum
  35.     * the parent directory ID
  36.     * the name of the file.
  37.  
  38. Software that dates from pre-HFS days doesn't know about directory IDs.
  39. For such code, there is a hack involving strange entities called "working
  40. directories". You can find the gory details in the File Manager chapter of
  41. Inside Macintosh Vol IV. Basically you can create a working directory to
  42. represent a directory on a volume, and then pass that WD refnum to code
  43. that expects a volume refnum. Trouble is, there is a limit to the total
  44. number of WDs that can exist at any time, and managing the damn things can
  45. get to be a pain.
  46.  
  47. Lawrence D'Oliveiro                       fone: +64-7-856-2889
  48. Computer Services Dept                     fax: +64-7-838-4066
  49. University of Waikato            electric mail: ldo@waikato.ac.nz
  50. Hamilton, New Zealand    37^ 47' 26" S, 175^ 19' 7" E, GMT+12:00
  51. I don't claim to be consistent. Yes I do!
  52.