Add datas in a file

BlitzMax Forums/BlitzMax Programming/Add datas in a file

ftbass(Posted 2005) [#1]
Hi all :)

I can't find any way to had datas in an existing file.
I did this

' File creation, and datas addition. No problem here
WriteFile("TestFile.txt")

file=OpenFile("TestFile.txt")

WriteLine(file, "test1")
WriteLine(file, "test2")

CloseFile file


' If I closed the file before, I can't add any datas :/
file=OpenFile("TestFile.txt")

While Not(Eof(file))
	ReadLine(file)
Wend

WriteLine(file, "test3")

CloseFile file


If anyone could help me, that would be great

see ya :)


PowerPC603(Posted 2005) [#2]
This does the trick:
' File creation, and datas addition. No problem here
WriteFile("c:\TestFile.txt")

file = OpenFile("c:\TestFile.txt")

WriteLine(file, "test1")
WriteLine(file, "test2")

CloseFile file



file = OpenFile("c:\TestFile.txt")

While Not Eof(file)
	Print ReadLine(file)
Wend

SeekStream file, StreamSize(file) ' <- line of miracles

WriteLine(file, "test3")

CloseFile file



file = OpenFile("c:\TestFile.txt")

While Not Eof(file)
	Print ReadLine(file)
Wend

CloseFile file



ftbass(Posted 2005) [#3]
thx for your answer :)
God bless you, miracle man :)
Jesus is alive

I'll try this at home

see you