Computer Science Canada

Read/Write help

Author:  Azzy [ 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

Author:  StrikerMagazine [ Sun Nov 02, 2003 12:01 am ]
Post 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

Author:  Tony [ Sun Nov 02, 2003 12:54 am ]
Post 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.


: