Thanks so much Robert, That cleared a lot of the fog. Now I just have to study this to make it jell. BTW you have just supplied me with a good set of REMs for my app. :-) Bruce Gottshall On Mon Sep 6 09:01:40 2004 Robert Covington wrote: >On Monday, September 6, 2004, at 08:26 AM, BrucesFB3@... wrote: >> Hello All, >> >> Given the code below: >> >> I understand this has something to do with opening files by >> double clicking icons in the Finder. >> >> I have been able to use the functions successfully. Everything >> works. >> >> My problem is that I don't know why it works. Obviously, >> FN FBWDToFSSpec() is checking for a particular type of error. >> What kind of error? What is the trigger? >I believe that it is checking that the file/folder exists in this >case...if it does, no error will occur. > >Often times one has to make an FSSpec for a file that doesn't exist >yet, so you'll get a -43 File Not Found error returned. In this case it >seems that it wants to verify that it does exist already, so if there's >noErr, then all is fine. > > >> Also in FN FBWDToFSSpec(), what are the purposes of >> FN FBWDToPBWD( pb ) and FN PBGetCatInfoSync( pb). >> What is the CInfoPBRec? >> FN FBWDToPBWD( pb ) >That makes a "classic" type of Param block situation work in Carbon, >the main difference being that in classic, a vRefnum is often a Working >Directory Reference number (folder number basically, an open one that >the system gives you)... and not a real volume reference number. > >In Carbon however, you need to use true vRefNums, which in OS X are >numbered -100,-200, -300 etc...for the volumes mounted. And also the >Directory ID's need to be sync'ed up or filled in too. FB does a lot of >this transparently using the FN FBWDToPBWD( pb ) convention, >automatically refinancing a WD into a VRefnum and doing any DirID work >too (I believe) > >You only need that in Carbon. It insures that the PB calls will return >valid results in carbon so you don't go writing to the North Pole when >you want the South, or just get stuck at the equator with no results. >> >> What is the meaning of the syntax, AS .Str63? (period before Str63). > >That means Pointer to String 63. Say you have dim 63 myText$ >You can pass that as @myText$[1] or often simply, @myText$ >Where that is going to will have it incoming as a string pointer. >Things like DrawText will want the former. Byte [0] is the length byte. >But FB will convert a string to a pointer as you go along, often don't >need to worry about it, as you can see in that code..only gFile$ is >passed in fn readFile$ , not @gFile$. > >Might be off on a couple, but hopefully I am not filling your head with >gunk. :) > >rc > >> Bruce Gottshall >> >> ==================== >> In the file handling code >> ==================== >> >> Clear Local Mode >> Local Fn FBWDToFSSpec(@namePtr As .Str63, vRefNum As Int,fSpec As >> .FSSpec) >> Dim err As OSErr >> Dim pb As CInfoPBRec >> '~'< >> pb.ioNamePtr = namePtr >> pb.ioVRefNum = vRefNum >> #If CarbonLib >> Fn FBWDToPBWD( pb ) >> #Endif >> err = Fn PBGetCatInfoSync( pb ) >> If err != _noErr Then Exit Fn >> fSpec.name = namePtr.nil$ >> fSpec.vRefNum = pb.ioVRefNum >> fSpec.parID = pb.ioFlParID >> End Fn = err >> '~'4 >> '============================== >> clear local >> dim theErr as OSErr >> dim AppFolderRef as long >> '~'1 >> local fn readFile$ >> AppFolderRef = system(_aplVol) >> theErr=fn FBMakeFSSpec(AppFolderRef,0,"",dataFileSpec) >> '------------------------------------------------- >> long if fn FBMakeFSSpec(AppFolderRef,0,"",dataFileSpec) = _noErr >> '------------------------------------------------- >> long if gFound >> xelse >> gFile$ = FILES$ (_FSSpecOpen,"ZDAT","Open which?...", dataFileSpec) >> gFound=_ztrue >> end if >> '------------------------------------------------- >> long if len(gFile$) // if not CANCELled >> long if Fn FBWDToFSSpec( gFile$, gVolRefNum, dataFileSpec ) = _noErr or >> gFound >> open "I",#1,@dataFileSpec >> '------------------------------------------------ >> FOR j=0 TO gNI >> READ #1, gDate$(J);8, gItem$(J);44, gComm$(J);44 >> READ #1, gChNum$(J);12, gAmt$(J);12 >> NEXT j >> '------------------------------------------------ >> CLOSE #1 >> end if >> end if >> end if >> end fn = gFile$ >> -- To unsubscribe, send ANY message to: futurebasic-unsubscribe@...