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

Username:   Password: 
 RegisterRegister   
 Window.Open and opening a written file
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
DarkMastermind




PostPosted: Mon Jun 20, 2005 5:32 pm   Post subject: Window.Open and opening a written file

I am trying to make a Pacman-type game, and at the end I would like to display a high-score table... The way I was planning on doing this was by writing to a file the user's score, then opening a new window and outputting the information stored in the file, which would probably be "highscores.txt" or whatever. I can't remember how I would take the user's name, score, and time to put into the file. So far, I have the very first line, I think, with variables already declared:
code:
open: file, "highscores.txt",put

I'm not sure where to go after that... Someone please refresh my memory?
Sponsor
Sponsor
Sponsor
sponsor
Cervantes




PostPosted: Mon Jun 20, 2005 6:16 pm   Post subject: (No subject)

Instad of opening with the intension of putting stuff, open if for [/b]get[/b] and put. Get all the data into an array, add the current user's score to the array (you should be using a flexible array), sort the array, then write the top 10 (or whatever) elements back.
For flexible arrays and file I/O, there are tutorials in the Turing Tutorials section. For sorting, check the Turing source code forum for a topic by Zylum called "sorting procedures".
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  [ 2 Posts ]
Jump to:   


Style:  
Search: