Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating Text Files

Status
Not open for further replies.

BorlandGeek

Programmer
Jun 14, 2004
27
CA
I am having difficulty figuring out how to create a text file

at this point this is what im doing

TFileStream * Comm;

try
{
Comm = new TFileStream("text.txt", fmOpenReadWrite);
}
catch(...) //if the file does not exist
{
Comm = new TFileStream("text.txt", fmCreate);
}
now when i print to the file...
Comm->WriteBuffer("text", 5);
it keeps replacing all my text before, also if I add
a \r it doesnt seem to want to work as a return...
anyone got any ideas..
 
Sorry i should have responded earlier... i figured it out
I used oldschool methods.. with just a FILE struct
and fopen, fwrite, fread... you get the picture.. worked well though...
 
I was going to suggest u to use TStringList.
It contains all old methods to append to a filein an easier way than the FILE struct.

--- LastCyborg ---
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top