TGC Codebase Backup



Append to file Function by X_MEN

5th Dec 2003 16:14
Summary

This is a Function that will help you to Append to your file that is aready created



Description



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    rem ============================================
rem APPEND TO FILE FUNCTION X_men
rem ============================================
rem Explor@ntlworld.com
rem --------------------------------------------

rem Count lines
`lines=0

`file$="..\readme.txt"

`OPEN(file$)


FUNCTION OPEN(file$)


`..........dont change..............

tempfile$="..\tempinfo.dat" 
if file exist(tempfile$) then delete file tempfile$


open to write 2,tempfile$
open to read 1,file$

	if file open(1)=1
		while file end(1)=0
			

`		read byte 1,1
`		read word 1,2
`		read long 1,3
`		read file 1,4
`		read float 1,5 

read string 1,a$





`		write byte 2,1 
`		write word 2,2
`		write long 2,3 
`		write file 2,4
`		write float 2,5

write string 2,a$

		endwhile

	endif
close file 1
append(file$,tempfile$)

endfunction



FUNCTION APPEND(file$,tempfile$)
`.......................................
`.......................................

`.........append to your file here......

`.......................................
`.......................................



write string 2,"did it work"
write string 2,"how did it go"
write string 2,"IT work..."




`........................................
`........................................
close file 2

if file exist(file$) then delete file file$
copy file tempfile$,file$
delete file tempfile$
endfunction