Data update
This commit is contained in:
parent
29a5eea0d4
commit
5c1bb7bfa9
2011 changed files with 35081 additions and 3229 deletions
|
|
@ -1,39 +1,57 @@
|
|||
/*
|
||||
|
||||
Rosetta Code File input/output example
|
||||
FutureBasic 7.0.14
|
||||
FutureBasic 7.0.24
|
||||
|
||||
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.
|
||||
5/11/24
|
||||
|
||||
*/
|
||||
|
||||
output file "FileInputOutput.app"
|
||||
|
||||
|
||||
void Local fn doIt
|
||||
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
|
||||
|
||||
CFURLRef inputURL = openpanel( 1, @"Open a text file",@"txt")
|
||||
if inputURL = NULL then end
|
||||
|
||||
str255 dataLine
|
||||
dataLine = ""
|
||||
if fn FileManagerContentsAtURL(inputURL) <> NULL
|
||||
open "I", 1, inputURL
|
||||
open "O", 2, outputURL
|
||||
|
||||
While Not Eof(2)
|
||||
Line Input #2, dataLine
|
||||
Print #1, dataLine
|
||||
While Not Eof(1)
|
||||
Line Input #1, dataLine
|
||||
Print #2, dataLine
|
||||
Wend
|
||||
|
||||
Close #1
|
||||
Close #2
|
||||
|
||||
Close #1
|
||||
alert 3,,@"File created on Desktop",@"output.txt",@"OK"
|
||||
end
|
||||
else
|
||||
alert 3,,@"File Not Found on Desktop",@"input.txt",@"OK"
|
||||
end
|
||||
end if
|
||||
|
||||
end fn
|
||||
|
||||
void local fn DoAppEvent( ev as long )
|
||||
select (ev)
|
||||
case _appDidFinishLaunching
|
||||
fn doIt
|
||||
end select
|
||||
end fn
|
||||
|
||||
|
||||
on AppEvent fn DoAppEvent
|
||||
|
||||
|
||||
handleevents
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue