| Help With Writing To A File 
 
	 
	
		| Author | Message |   
		| bizkit 
 
 
 
 
 | 
			
				|  Posted: 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:
 
 procedure cashierupdate
 open : streamnumber, cashiernumber, put
 var number : int
 number := 1
 loop
 
 put : streamnumber, cashupfilestring (flag2)
 
 number += 1
 exit when number = flag2
 end loop
 close : streamnumber
 end cashierupdate
 
 i need help with this asap plz thx alot
 bizkit
 |  
				|  |  |   
		|  |  |  
	  
		|  |   
		| Sponsor Sponsor
 
  
   |  |   
		|  |   
		| Tony 
 
  
 
 
 | 
			
				|  Posted: Wed Jan 22, 2003 10:38 am    Post subject: (No subject) |  |   
				| 
 |  
				| 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.
 
 
 	  | code: |  	  | 
loop
 exit when eof(streamnum)
 get : steamnum, variable
 end loop
 
 | 
 |  
				|  Tony's programming blog. DWITE - a programming contest. |  |   
		|  |  |  
	  
		|  |   
		|  |  
 |