input at eof
Author |
Message |
Jas
|
Posted: Thu May 05, 2005 5:26 pm Post subject: input at eof |
|
|
I am doing this program where i have to add new information to a datafile everytime i run it. And if i run the program the second time, and i try to input something into it, the data that was already in it, gets overwritten. How would you make a program so it takes you to the end of the data file, where you can start inputting the new information?
I tried doing:
code: |
eof (streamNumber)
put : %new information
|
but it didn't work. Plz help! |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Paul
|
Posted: Thu May 05, 2005 6:42 pm Post subject: (No subject) |
|
|
Just use seek, its pretty easy just to go to turing reference and read up on the open function, but hey, I learned something too, lazy me.
code: |
var file: string:= "text.txt"
var input: int
var temp: string:="hi"
open: input, file, put, seek, mod
seek: input, * %finds you the end of the file
put: input, temp
|
thats pretty much straight out of the reference. |
|
|
|
|
|
Token
|
Posted: Thu May 05, 2005 7:38 pm Post subject: (No subject) |
|
|
This is what i do since i cant get mod to work for me...
code: |
File.Copy ("highscores.txt", "temp.txt")
open : streamin, "temp.txt", get
open : streamout, "highscores.txt", put
loop
exit when eof (streamin)
get : streamin, data
put : streamout, data, " " ..
end loop
%%%add new info here
close : streamin
close : streamout
File.Delete ("temp")
|
|
|
|
|
|
|
|
|