[futurebasic] Re: [FB] Question about the FSRef filesystem

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : January 2009 : Group Archive : Group : All Groups

From: Piet en Claudine <cp.halsberghe@...>
Date: Tue, 13 Jan 2009 18:59:39 +0100
Thanks Robert,

This was the little missing link,
Now it's working fine.

Bye Piet (Belgium)



> Piet en Claudine wrote:
> 
>> I¹am changing the filesystems in my applications from FSSpec to FSRef
>> But I don¹ find how to write an read a file to and from a fix
>> location (in the case of my example HD:soft:Optimafiles)
>> presuming that the folder (Optimafiles) already exist.
>> I used to do this with the folowing code using FSSpec
> 
>> fn FSMakeFSSpec( 1, _fsRtDirID, "HD:soft:Optimafiles:testfile",
>> @fileadres )
>> open "O", 1, @fileadres
>> close
> 
> include "Util_FileDirectory.incl"
> dim as CFStringRef parentPath
> dim as FSRef       parentRef
> dim as OSStatus    err
> 
> parentPath = fn CFSTR( "/Volumes/HD/soft/Optimafiles" )
> err = fn FD_PathGetFSRef( parentPath, 0, @parentRef )
> if ( err ) then stop "FD_PathGetFSRef error " + str$( err )
> open "O", 1, "testfile", parentRef
> close
> 
> Robert P.
>