Write text

Just starting out? Need help? Post your questions and find answers here.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by marlo.

I need to write text to a created text file, to append more lines of text,i try with OpenFile(0,"mytext.txt") and then WriteString("my new text") , but only replace the text not append the text on new line, i test also with WriteStringN and the same thing.

Thanks for help.


from the ass of the world
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by freak.

Just add this line after the OpenFile() command:

Code: Select all

FileSeek(Lof())
Now every WriteString() command writes al the End
of the File.

Timo

--------------------------------
Programming today is a race between software engineers striving to build bigger and
better idiot-proof programs and the universe trying to produce bigger and better idiots.

...So far, the universe is winning.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by ricardo.
Originally posted by marlo

I need to write text to a created text file, to append more lines of text,i try with OpenFile(0,"mytext.txt") and then WriteString("my new text") , but only replace the text not append the text on new line, i test also with WriteStringN and the same thing.
Thanks for help.
from the ass of the world
Hola argentino !!

OpenFile(0,"Myfile.txt)
FileSeek(Lof());Go to the end of the file
WriteString("my new text")
CloseFile(0)
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by PB.

Check out my small AddLine procedure at the following page, which uses
the concepts already explained by Ricardo/Freak above:

viewtopic.php?t=336


PB - Registered PureBasic Coder
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by marlo.

Thanks PB, Freak
y muchisimas gracias Ricardo !

from the ass of the world
Post Reply