Restore ? Data list_of_values

Blitz3D Forums/Blitz3D Beginners Area/Restore ? Data list_of_values

Here is a example of how to do Restore? But I want to get data from a text.txt file?

My question is how can I read from a file?
.startData
;something like this
test=Read( "test.txt" ) ???




Print "Here we go!"

; Restore to the start of the Data statements
Restore startData

; Get the first number which is the total number of users
Read Users

; Print them all!
For T = 1 To Users
Read firstname$
Read age
Read accuracy#
Read lastname$
Print firstname$ + " " + lastname$ + " is " + age + " years old with " + accuracy# + " accuracy!"
Next

While Not KeyHit(1)
Wend
End

.startData
Data 3
Data "Shane", 31, 33.3333, "Monroe"
Data "Bob", 28, 12.25, "Smith"
Data "Roger", 54, 66.66, "Rabbit"

Um, did you actually look in the command reference? (okay, I guess you did if you got your other code example from there). Anyway, look under "file" for all your file commands... then look up the command, "readfile"... there is a complete working example program there.

You'll want to have your code check for commas (ones that are not enclosed in quotation marks) and grab the data from it. If there is a certain layout to your text document this becomes all the more easier.