Computer Science Canada

Help to get a write problem fixed

Author:  thoughtful [ Mon Sep 29, 2003 9:16 pm ]
Post subject:  Help to get a write problem fixed

Ok....here is the code for writing records to a file...which i will use for a porogram..The only problem is that every time i run it, it deletes all the previous information in the text file.
if n e one can help me with this i will be really grateful.

-=code starts here=-

var stream : int
var d_city, a_city : string
var dist : string

open : stream, "database", put
assert stream > 0
loop
put "Airport Database Creator"
put "Please enter the name of departure city or put 'stop' now to Quit "
get d_city : *

exit when d_city = "stop"
put "Please enter the name of arrival city"
get a_city

put "Please enter distance between ", d_city, " and ", a_city, " ."
get dist

put : stream, d_city
put : stream, a_city
put : stream, dist

end loop
close : stream

-=code ends here=-

*it will generate the text file once u run it.

Author:  AsianSensation [ Mon Sep 29, 2003 10:27 pm ]
Post subject: 

yes, it's suppose to delete the file once you output to it new items.

there is a tutorial about this, in the tutorial section, forgot the link, but it should be a sticky.

Author:  AsianSensation [ Mon Sep 29, 2003 10:30 pm ]
Post subject: 

http://www.compsci.ca/v2/viewtopic.php?t=427

here, found it, just go to that link, Blade has written an excellent tutorial.


: