home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / sys / mac / programm / 14847 < prev    next >
Encoding:
Internet Message Format  |  1992-09-01  |  1.4 KB

  1. Path: sparky!uunet!pmafire!news.dell.com!swrinde!elroy.jpl.nasa.gov!ames!data.nas.nasa.gov!taligent!keith@taligent.com
  2. From: keith@taligent.com (Keith Rollin)
  3. Newsgroups: comp.sys.mac.programmer
  4. Subject: Re: Beginner's question on StandardPutFile
  5. Message-ID: <Btwx5n.7L1@taligent.com>
  6. Date: 1 Sep 92 18:39:23 GMT
  7. References: <ewu1.715348919@husc8>
  8. Sender: usenet@taligent.com (More Bytes Than You Can Read)
  9. Organization: Taligent
  10. Lines: 29
  11.  
  12. In article <ewu1.715348919@husc8>, ewu1@husc8.harvard.edu (Elwin Wu) writes:
  13. > I'm having trouble getting the volume reference number returned by the
  14. > StandardPutFile routine.  I want to use SetVol and my code typically
  15. > looks something like this (I'm using Think C 5.0):
  16. >     StandardPutFile(prompt,defaultName,&theReply);
  17. >     SetVol(theReply.sfFile.vRefNum);
  18. > Should I use something other that SetVol???  Any help would be
  19. > appreciated.  Thanks
  20.  
  21. IMHO, you should replace the line containing SetVol with a blank line.
  22. "theReply.sfFile" contains everything you need to access the file. If you want
  23. to open the data for, call FSpOpenDF. If you want to open the resource fork,
  24. call FSpOpenResFile. You don't need to change the default directory.
  25.  
  26. If, for some arcane reason, you feel you _do_ need to change the default
  27. directory, do it thusly:
  28.  
  29.     GetVol(nil, &oldVol);
  30.     HSetVol(nil, theReply.sfFile.vRefNum, theReply.sfFile.parID);
  31.     DoMyStuff();
  32.     SetVol(nil, oldVol);
  33.  
  34. --
  35. Keith Rollin
  36. Phantom Programmer
  37. Taligent, Inc.
  38.