BBC BASIC for Windows
Programming >> Database and Files >> writing to disk file http://bb4w.conforums.com/index.cgi?board=database&action=display&num=1392263322 writing to disk file
Post by Wendell on Feb 13th, 2014, 01:55am
workfl=OPENOUT("workfl1") INPUT age
how would i write Age to workl1 file Re: writing to disk file
Post by admin on Feb 13th, 2014, 02:48am
If you are writing it to the file with the intention of reading it back in a BASIC program (in other words you are happy for it to be written in an internal, binary, format):
Code:
workfl=OPENOUT("workfl1.dat")
INPUT age
PRINT #workfl, age
If you are writing it with a view to the file being read by a different application, so you need to store it in a 'universal' format, then write it as a string and use a CRLF termination:
Code:
workfl=OPENOUT("workfl1.txt")
INPUT age
PRINT #workfl, STR$(age)
BPUT #workfl, 10
Note that in each case I have emphasised the nature of the file by adding an explicit extension (.dat in the case of the binary file, .txt in the case of the ASCII file). Omitting the extension altogether isn't recommended, because it will default to .bbc and the file is likely to be mistaken for a BASIC program.
Richard. Re: writing to disk file
Post by Wendell on Feb 13th, 2014, 05:04am