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 thank McMerfy for his answer and I hope he will answer it again. I don't really understand where I have to put the #10 and #13. I join a example of code, can you show me where I have to put it ?
// 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 ! "
}