Acorn Arcade forums: Programming: BASIC output to file
|
BASIC output to file |
|
(13:58 15/6/2002) incubus (12:31 8/5/2001) guy (14:19 8/5/2001) Matthew (10:02 9/5/2001) guy (13:10 9/5/2001)
|
|
incubus |
Message #4767, posted at 12:31, 8/5/2001, in reply to message #4766 |
Unregistered user
|
Try this: CH = OPENOUT"test" PRINT #CH,"Hello World" CLOSE #CH Will create a file called "test" and print "Hello World" into it. To do byte writes to a file use BPUT #CH, value where value is 0 to 255 Reading from the file CH = OPENIN"test" INPUT#CH, text$ CLOSE #CH PRINT text$ Also, other file commands: PTR#CH = x sets the file pointer to x PRINT PTR#CH to display the current file pointer PRINT EXT#CH to display the file size Hope this helps |
|
[ Log in to reply ] |
|
guy |
Message #4768, posted at 14:19, 8/5/2001, in reply to message #4767 |
Unregistered user
|
looks the biz. wait till I get home!many thanks. |
|
[ Log in to reply ] |
|
Matthew |
Message #4769, posted at 10:02, 9/5/2001, in reply to message #4767 |
Unregistered user
|
CH = OPENOUT"test" PRINT #CH,"Hello World" CLOSE #CHWill create a file called "test" and print "Hello World" into it.
I prefer BPUT#CH,"Hello World" (BPUT# can take a byte, as you said, but also a string). This puts the string in the file, but in a readable format. To get it back, use GET$#CH. You can find help in BASIC by typing "HELP <command>" or "HELP ." for a list of all commands. ATB, Matthew |
|
[ Log in to reply ] |
|
guy |
Message #4770, posted at 13:10, 9/5/2001, in reply to message #4769 |
Unregistered user
|
I prefer BPUT#CH,"Hello World" (BPUT# can take a byte, as you said, but also a string). This puts the string in the file, but in a readable format. To get it back, use GET$#CH. Thanks, I'll try this too.You can find help in BASIC by typing "HELP <command>" or "HELP ." for a list of all commands. Great, if I knew what commands I was looking for... .. but then I do now, don't I? Thanks again. |
|
[ Log in to reply ] |
|
guy |
Message #4766, posted at 13:58, 15/6/2002 |
Unregistered user
|
Hi, sounds so simple, but I don't have a BBC basic manual handy. What are the BBC Basic commands to create/open an output file (on my A5000), send text to it and close it again? A "hello world" example would be nice If this is beneath the Icon Bar's dignity, what is the url of Archive-on-line? |
|
[ Log in to reply ] |
|
|
Acorn Arcade forums: Programming: BASIC output to file |