Hey all out here!!
I have got a problem with a test program I am writeing.
This program is to load a file into a ListBox which I cal FileIndex
Each line in the file is written to a line in FileIndex
So far I got the program to write as it is supposed to
however, in the end of each line it writes a symbol that loks like this []
I suppose it is a rowBreak(or somthing like it).
Is there a way to exclude this sign?
void __fastcall TForm1::Button1Click(TObject *Sender)
{/*
switch(MessageBox(Handle,(AnsiString("OK to erase and load new file?").c_str(), "Load new file...",MB_OKCANCEL | MB_ICONHAND))
{
case ID_CANCEL : Abort(); // Ignore this part is is not a vital code
}*/
FileIndex->Items->Clear(); // Clear all lines
if(OpenDialog->Execute()) // Select a file
{
FILE *f;
char rows[82];
AnsiString line,name,value;
name=OpenDialog->FileName;
f=fopen(name.c_str(),"r" // open file
while(fgets(rows,81,f)) // Parts of this code I got
{ // from an other guy, I just
line=(AnsiString)rows; // made it suit my purpose
int max = strlen(line.c_str()); // get length of row
value=line.SubString(0,max);
FileIndex->Items->Add(line); // Write file line to FileIndex, the ListBox
}
}
}
Thanks for any help!!
Martin!!
I have got a problem with a test program I am writeing.
This program is to load a file into a ListBox which I cal FileIndex
Each line in the file is written to a line in FileIndex
So far I got the program to write as it is supposed to
however, in the end of each line it writes a symbol that loks like this []
I suppose it is a rowBreak(or somthing like it).
Is there a way to exclude this sign?
void __fastcall TForm1::Button1Click(TObject *Sender)
{/*
switch(MessageBox(Handle,(AnsiString("OK to erase and load new file?").c_str(), "Load new file...",MB_OKCANCEL | MB_ICONHAND))
{
case ID_CANCEL : Abort(); // Ignore this part is is not a vital code
}*/
FileIndex->Items->Clear(); // Clear all lines
if(OpenDialog->Execute()) // Select a file
{
FILE *f;
char rows[82];
AnsiString line,name,value;
name=OpenDialog->FileName;
f=fopen(name.c_str(),"r" // open file
while(fgets(rows,81,f)) // Parts of this code I got
{ // from an other guy, I just
line=(AnsiString)rows; // made it suit my purpose
int max = strlen(line.c_str()); // get length of row
value=line.SubString(0,max);
FileIndex->Items->Add(line); // Write file line to FileIndex, the ListBox
}
}
}
Thanks for any help!!
Martin!!