[futurebasic] Re: [FB] One last question

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : June 2014 : Group Archive : Group : All Groups

From: Bernie <fblist.bw@...>
Date: Mon, 9 Jun 2014 20:03:17 +0100
Bill Tomlinson wrote:

> I  tried modifying it to make it output file instead of input. I tried to write string numbers 1-100 as a test, but then got an error message (attached). Is there some sort of minimal change that will make it work?
> 
> 
> Include "Util_FileDirectory.incl"
> 
> dim as CFURLRef appDirURL, fileURL
> dim as Str255 b
> dim i%
> 
> fn FD_ApplicationDirectoryCreateCFURL( @appDirURL )	// get the URL of this app’s directory
> fileURL = fn CFURLCreateCopyAppendingPathComponent( _kCFAllocatorDefault, appDirURL, @"TestData.txt", _false )	// create file URL
> CFRelease( appDirURL )	// we’re done with this - release it
> 
> if ( fn FD_ObjectExistsCFURL( fileURL ) )
> open "O", 1, fileURL
> for i=1 to 100
> b$=str$(i)
> print #1, b
> next i
> close 1
> end if
> 
> CFRelease( fileURL )	// clean up
> 
> rem RunApplicationEventLoop()
> 

Looks like a possible bug in FBtoC. Try adding an ‘@‘ before fileURL:

open "O", 1, @fileURL