Computer Science Canada History in a text file |
Author: | WooFerPPK [ Wed Dec 18, 2002 4:29 pm ] |
Post subject: | History in a text file |
Im making a Quiz program. I would like to make a text file that keeps track of all the scores at the end. How would i be able to make turing create a .txt file, make it read it and put the name and score on the screen ranging from the best to the worst? |
Author: | Tony [ Wed Dec 18, 2002 5:04 pm ] |
Post subject: | |
Dan posted a very nice tutorial on reading/writing to an external file, its available @ http://danco.no-ip.com/turing/viewtopic.php?t=5 |
Author: | FizixMan [ Wed Dec 18, 2002 5:17 pm ] | ||
Post subject: | |||
regarding file input/output, you need a couple things: 1) variables to store the file number (an integer; you use this number to tell turing which file to use), a file name (a string; the path and name of the file) 2) you need an "open" statement along with some extra parameters to tell turing what you'll be doing with that file (like "put" or "get", there are some others too) 3) similar statements to "put" and "get" with a bit of a change 4) a "close" statement to close the file once you're done with it.
More code than what I usually show, but I hope it helps. Try to understand what is written here and write your own code from scratch (even if it is similar to this) rather than just copying and pasting it. If you don't understand parts of it, PLEASE ask us. Otherwise you might be back here asking for the same help again. |
Author: | FizixMan [ Wed Dec 18, 2002 5:20 pm ] |
Post subject: | |
Darn you Tony!! DARN YOU!!!! lol, always posting at the same time as me! grrrrrrrrrrrrrrrrrrrrrrrrrrr |
Author: | Tony [ Wed Dec 18, 2002 5:21 pm ] |
Post subject: | |
lol, this time you got here a bit faster... I was just gonna say *waits for FizixMan to get pissed* but then I saw your 2nd message Hey, its cool... You got that sorting thing there |
Author: | WooFerPPK [ Wed Dec 18, 2002 9:18 pm ] |
Post subject: | |
thanks alot |