Computer Science Canada
Help With Writing To A File
|Author:||bizkit [ Wed Jan 22, 2003 8:04 am ]|
|Post subject:||Help With Writing To A File|
I am creating a cashier file. With every customer it writes to a log file and then its supposed to shift down to the next line, the only problem is that it overwrites the existing log data and wont shift down the line
my code is as follows:
open : streamnumber, cashiernumber, put
var number : int
number := 1
put : streamnumber, cashupfilestring (flag2)
number += 1
exit when number = flag2
close : streamnumber
i need help with this asap plz thx alot
|Author:||Tony [ Wed Jan 22, 2003 10:38 am ]|
there're multiple solutions to your problem.
Each time you open the file, it reads/writes from the beginning... So if you don't close the file at the end of your procedure, it shoud not overwrite existing info.
Another approach (need this is you open up the program again). Run a loop to read through entire file, this will place you at the of of it, so you can continue to add new information.