[comp.sys.mac.programmer] getting the necessary vRefNum

sonenbli@oxy.edu (Andrew D. Sonenblick) (08/27/89)

oops, I can't seem to find the flashlight...

sonenbli@oxy.edu (Andrew D. Sonenblick) (08/27/89)

     Ok, you're a happy-go-lucky application on a Macintosh, eager to please
     your use in any way you can.  Suddenly, your user types in the name of
     a file which s/he _knows_ is on the current volume, and wants you to
     return the vRefNum that corresponds with that file--in other words, the
     vRefNum such that the call SetVol(0,vRefNum); would ensure that the call
     OpenResFile(&fileName); would not return FileNotFound error.  What would
     your code look like...    keeping in mind that no calls to SFPut/GetFile
     are ever executed...


     Also, as an Apple Macintosh, you know that all those knowledgable users
     or programmers who can provide the necessary code will feel an incredible
     amount of personal joy and a true sense of self worth if they just take
     the time to share their solution code snipet with those of less knowledge
     and experience!   Not only that, it would make you a Happy Mac!

     sonenbli@oxy.edu

tim@hoptoad.uucp (Tim Maroney) (08/29/89)

In article <48131@tiger.oxy.edu> sonenbli@oxy.edu (Andrew D. Sonenblick) writes:
>     Ok, you're a happy-go-lucky application on a Macintosh, eager to please
>     your use in any way you can.  Suddenly, your user types in the name of
>     a file which s/he _knows_ is on the current volume, and wants you to
>     return the vRefNum that corresponds with that file--in other words, the
>     vRefNum such that the call SetVol(0,vRefNum); would ensure that the call
>     OpenResFile(&fileName); would not return FileNotFound error.  What would
>     your code look like...    keeping in mind that no calls to SFPut/GetFile
>     are ever executed...

You're eager to please the user in any way you can.  So you force her
to type in names of existing files and you don't use Standard File.
What's wrong with this picture?
-- 
Tim Maroney, Mac Software Consultant, sun!hoptoad!tim, tim@toad.com

"It is better to be a human being dissatisfied than a pig satisfied;
 better to be Socrates dissatisfied than a fool satisfied."
	-- John Stuart Mill, UTILITARIANISM (1863)