Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 input at eof
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Jas




PostPosted: 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
Sponsor
sponsor
Paul




PostPosted: 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




PostPosted: 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")
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: