Writing and reading data to/from a file
BlitzPlus Forums/BlitzPlus Programming/Writing and reading data to/from a file
| ||
| Is there a way to read a line of values from a .txt file and put it into a data line? example: file.txt 1,63,24 6,21,3 4,154,38 turns into data 1,63,24 data 6,21,3 data 4,154,38 |
| ||
| Well what you can do is read the file, and save a new file with data statements in it, to be used when you next compile the program. Otherwise, you can't generate Data statements on the fly, I'm sorry. You may also read the file and directly use it as data values. What would you like to do exactly ? Could you be more specific ? Sergio. |
| ||
something like
rd=readfile("data.txt") ; open the file for read operations
if rd <>0 ;check if the file is open
wr=writefile("data.bb") ; open a file for writing operations
repeat
writeline wr,"Data "+readline$(rd)
until eof(rd)
closefile rd
closefile wr
else
notify "failure in reading the file"
endif
end
|