40 lines
858 B
Plaintext
40 lines
858 B
Plaintext
/*
|
|
|
|
Rosetta Code File input/output example
|
|
FutureBasic 7.0.14
|
|
|
|
Rich Love
|
|
9/25/22
|
|
|
|
Before running this, use TextEdit to create a file called input.txt on your desktop.
|
|
Format as plain text and create a few lines of text.
|
|
Then save.
|
|
|
|
*/
|
|
|
|
output file "FileInputOutput.app"
|
|
|
|
CFURLRef ParentDirectory // Create a url for the desktop
|
|
ParentDirectory = fn FileManagerURLForDirectory( NSDesktopDirectory, NSUserDomainMask )
|
|
|
|
CFURLRef inputURL // Create a url for input.txt on the desktop
|
|
inputURL = fn URLByAppendingPathComponent( ParentDirectory, @"input.txt" )
|
|
|
|
CFURLRef outputURL // Create a url for output.txt on the desktop
|
|
outputURL = fn URLByAppendingPathComponent( ParentDirectory, @"output.txt" )
|
|
|
|
open "O", 1, outputURL
|
|
open "I", 2, inputURL
|
|
|
|
str255 dataLine
|
|
|
|
While Not Eof(2)
|
|
Line Input #2, dataLine
|
|
Print #1, dataLine
|
|
Wend
|
|
|
|
Close #1
|
|
Close #2
|
|
|
|
end
|