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

Username:   Password: 
 RegisterRegister   
 help on reading and writing to a file in turing
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
JustTrying2GetBy




PostPosted: Sun Oct 24, 2004 5:24 pm   Post subject: help on reading and writing to a file in turing

I am having some trouble getting this program to work. If someone could please help me by finding the fix to the problem.

code:

var name, country : string
var filevar : int
var holdit : string (1)

open : filevar, "a:/animal", put
for counter : 1 .. 2
    put "Please enter name of the #" ,counter, " animal followed by country "..
    get name, country
end for

close : filevar
put ""


open : filevar, "a:/animal", get
put "This is the display for all the animals and countries."
put "When you are ready press Enter to get contents "
put "of the file.."

getch (holdit)
cls
for counter : 1 .. 2
    get : filevar, name, country
    put "Animal= ", name, " Country= ", country
end for
close : filevar
Sponsor
Sponsor
Sponsor
sponsor
Delos




PostPosted: Sun Oct 24, 2004 5:46 pm   Post subject: (No subject)

Easy.

You opened the file, got the input from the User, then closed the file. At no point did you write anything to it.

code:

put : filevar, name
put : filevar, country


These will be of some use to you:

File Manipulation by Dan
More file manipulation by Delta
High Scores by Dan (good example of file reading/writing
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: