[futurebasic]

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

From: Bill Tomlinson <billtomlinson@...>
Date: Mon, 09 Jun 2014 10:10:57 -0700
Thanks guys.

The first one I tried, the one below, worked fine. It was the shortest and had the least number of concepts I didn't understand.
You've all been such great help.


On Jun 8, 2014, at 11:14 PM, Bernie wrote:

> 
> Bill Tomlinson wrote:
> 
>> I just want to open a fixedname text file that stashed in the same folder as my program.
> 
> 
> Brian’s code modified to use URLs rather than paths
> 
> '---------------
> include "Util_FileDirectory.incl"
> 
> dim as CFURLRef appDirURL, fileURL
> dim as Str255 b
> 
> 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 "I", 1, fileURL
> while not eof( 1 )
> line input #1, b
> print b
> wend
> close 1
> xelse
> print "File does not exist!"
> end if
> 
> CFRelease( fileURL )	// clean up
> 
> RunApplicationEventLoop()
> '---------------
>