BigValerie
Programmer
I would like to go to the next line in a text file that I write with the component TFileStream of Borland C++ Builder 4. I tried with \n, Char(10) but it make only a strange symbol in my file. I join an exemple of code, has anybody the answer ?
// Example of Program
void __fastcall TForm1::Button1Click(TObject *Sender)
{
AnsiString sVariableOne = "- How";
AnsiString sVariableTwo = "are";
AnsiString sVariableThree = "you ?";
//I would like a new line here
AnsiString sVariableFour = "- Fine, Thank you";
TFileStream *TextDateiFehr =
new TFileStream("D:\\MesProgrammes\\Daten\\EssaiValEndl",fmCreate);
int iPosition=0;
TextDateiFehr->Write(sVariableOne.c_str(),sVariableOne.Length());
iPosition += 6;
TextDateiFehr->Position=iPosition;
TextDateiFehr->Write(sVariableTwo.c_str(),sVariableTwo.Length());
iPosition += 4;
TextDateiFehr->Position=iPosition;
TextDateiFehr->Write(sVariableThree.c_str(),sVariableThree.Length());
iPosition += 6;
TextDateiFehr->Position=iPosition;
TextDateiFehr->Write(sVariableFour.c_str(),sVariableFour.Length());
delete TextDateiFehr;
ShowMessage(" Der Programm ist durch ! "
}
// Example of Program
void __fastcall TForm1::Button1Click(TObject *Sender)
{
AnsiString sVariableOne = "- How";
AnsiString sVariableTwo = "are";
AnsiString sVariableThree = "you ?";
//I would like a new line here
AnsiString sVariableFour = "- Fine, Thank you";
TFileStream *TextDateiFehr =
new TFileStream("D:\\MesProgrammes\\Daten\\EssaiValEndl",fmCreate);
int iPosition=0;
TextDateiFehr->Write(sVariableOne.c_str(),sVariableOne.Length());
iPosition += 6;
TextDateiFehr->Position=iPosition;
TextDateiFehr->Write(sVariableTwo.c_str(),sVariableTwo.Length());
iPosition += 4;
TextDateiFehr->Position=iPosition;
TextDateiFehr->Write(sVariableThree.c_str(),sVariableThree.Length());
iPosition += 6;
TextDateiFehr->Position=iPosition;
TextDateiFehr->Write(sVariableFour.c_str(),sVariableFour.Length());
delete TextDateiFehr;
ShowMessage(" Der Programm ist durch ! "
}