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

Username:   Password: 
 RegisterRegister   
 Read/Write help
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Azzy




PostPosted: Sat Nov 01, 2003 11:24 pm   Post subject: Read/Write help

can someone tell me why this code isn't working?

code:
open : fileNo, "IDS" , write
write : fileNo, ID, name
close : fileNo
open : fileNo, "IDS" , read, put
read : fileNo, ID
put : fileNo, ID
read : fileNo, name
put : fileNo, name
close : fileNo
Sponsor
Sponsor
Sponsor
sponsor
StrikerMagazine




PostPosted: Sun Nov 02, 2003 12:01 am   Post subject: (No subject)

Hm.. when you opened with fileNo for the second time, you said you were going to use it for both 'read' and 'put'.. i dont think you're allowed to do that.. every time you want to get from the file instead of output, you could close and reopen it. i guess so it would look like this
code:
open : fileNo, "IDS" , write
write : fileNo, ID, name
close : fileNo
open : fileNo, "IDS" , read
read : fileNo, ID
close : fileNo
open : fileNo, "IDS", put
put : fileNo, ID
close :fileNo
open :fileNo, "IDS",read
read : fileNo, name
close : fileNo
open :fileNo, "IDS", put
put : fileNo, name
close : fileNo
Tony




PostPosted: Sun Nov 02, 2003 12:54 am   Post subject: (No subject)

I think there's a tutorial somewhere on reading/writing to a file.

you can also open the file for "search", and can find a point from which you want to read/write, instead of reopening the file.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
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: