Computer Science Canada Files Input/output |
Author: | paulkwatyra [ Sat Jan 07, 2006 6:44 pm ] |
Post subject: | Files Input/output |
ok so i have this code [code] var mmark, smark : real var name : string var stream, streamin : int var total : real loop open : streamin, "TEST.txt", get put "What is your name?" get name : * if name = "exit" then exit end if cls put "Hello: ", name put "What did you recieve in Math" get mmark cls put "What did you recieve in Science" get smark cls put "THANK YOU" total := (mmark + smark) div 2 delay (1000) put "Your average is: ", total close : streamin delay (2000) open : stream, "TEST.txt", put put : stream, "STUDENT NAME: ", name put : stream, "AVERAGE FOR STUDENT: ", total close : stream cls put "Next Student Please :type exit to exit" end loop [/code] ---->NOTE<---- There needs to be a TEST.txt in the directory you saved this code int however i cant get it to save multiple students in the directory TEST.txt how do you make it so that you can save lists of students into the directory. One more question is there anyway to create a new txt file from turing so that you dont need a TEST.txt to make it work?? |
Author: | person [ Sat Jan 07, 2006 7:19 pm ] | ||
Post subject: | |||
i really didnt understand y u needed to have streamin |
Author: | paulkwatyra [ Sat Jan 07, 2006 7:47 pm ] |
Post subject: | |
sry extra var |
Author: | paulkwatyra [ Sun Jan 08, 2006 5:41 pm ] |
Post subject: | |
NEONE GOIN TO HELP OR WUT |
Author: | iker [ Sun Jan 08, 2006 6:23 pm ] |
Post subject: | |
paulkwatyra wrote: NEONE GOIN TO HELP OR WUT
probly not if your asking like that. Try searching close, get, put, read, write, seek and tell statements. in the help file, it will tell you all about that, or try [/url=http://www.compsci.ca/v2/search.php]SEARCHING[/url] this website older topics about what you are asking... isn't that what we are supposed to do? |
Author: | MysticVegeta [ Sun Jan 08, 2006 7:54 pm ] |
Post subject: | |
When you close the stream # you close the file so in order to write again to that file you dont close the stream # until the user exits the loop. So Instead of having close : stream in the loop, put it after. |