[futurebasic] FSRef File Open For Writing

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : November 2008 : Group Archive : Group : All Groups

From: Deep <Info@...>
Date: Sun, 30 Nov 2008 22:02:41 +0000
Trying to write to a file using FSRef. Looked at the "FBShell [nib + CE]"
example which provides a FSRef to a chosen file (chosen via the File menu,
NavDialog) hence not from the usual FILES$.

Examples are clear when the FSRef has originated from FILES$.

How can an FSRef of a file be converted into the FSRef of the parent? See
below for sample code:


local fn GetFileHandler( reply as ^NavReplyRecord, userData as pointer )
'~'1
dim as Str255   name
dim as FSRef    ref, parentFolderRef

NavDialog_GetItemFSRef( #reply, 1, @ref )
GetNameAsPascalStringFromFSRef( @ref, @name )

// Need to convert "ref" into "parentFolderRef"

open "O", 1, s, @parentFolderRef
print #1,"some dummy text"
close #1

end fn