Board index » cppbuilder » ListBox->StringList->File

ListBox->StringList->File

Hallo,
the guestion is, how can i an an Item from a List Box [second Line] to a
file like this ["my text" + 2 Line from a ListBox].

I put the 2nd Item of a ListBox into a ListString like this:

int i;
TStringList *List = new TStringList;
for(i = 0; i < ListBox1->Items->Count; i++)
{
 List->Add(ListBox1->Items->Strings[1]);

Quote
}

delete List;

The Problem is, I would like to write (List) into a String (Str) so that I
add it to a file like this,

#include <fstream.h>
.....
ofstream listtxt;
listtxt.open("list.txt");
if (!listtxt)
{
Form1->Color=clRed;

Quote
}

else
{
listtxt << "my Text" + Str.c_str(); << endl;
listtxt.close();
Close();

Quote
}

I would be thnkfull for your answer.
thanks
John
 

Re:ListBox->StringList->File


List->Text.c_str()

Other Threads