Board index » cppbuilder » Reading in a delimeted file

Reading in a delimeted file


2004-09-28 04:21:29 AM
cppbuilder0
I have a comma deli. file. end char is || double pipe between rec. it is
in text form. How can I read this in Record by record ? the file is large
6mg. using Builder 5 Pro
 
 

Re:Reading in a delimeted file

Must be too hard of a question
"Mr_Who" <None>wrote in message news:41587647$ XXXX@XXXXX.COM ...
Quote
I have a comma deli. file. end char is || double pipe between rec. it
is in text form. How can I read this in Record by record ? the file is
large 6mg. using Builder 5 Pro

 

Re:Reading in a delimeted file

Something like this?
int iFileHandle;
int iFileLength;
int iBytesRead;
char *pszBuffer;
if (OpenDialog1->Execute())
{
iFileHandle = FileOpen(OpenDialog1->FileName, fmOpenRead);
iFileLength = FileSeek(iFileHandle,0,2);
FileSeek(iFileHandle,0,0);
pszBuffer = new char[iFileLength+1];
iBytesRead = FileRead(iFileHandle, pszBuffer, iFileLength);
FileClose(iFileHandle);
int i=0;
while (i<iBytesRead)
{
AnsiString temp="";
while (pszBuffer[i]!='|' && pszBuffer[i+1]!='|') {
temp+=pszBuffer[i];
i++;
}
ListBox1->Items->Add(temp);
i++;
}
delete [] pszBuffer;
}
}
HI
Mr_Who wrote:
Quote
I have a comma deli. file. end char is || double pipe between rec. it is
in text form. How can I read this in Record by record ? the file is large
6mg. using Builder 5 Pro


 

{smallsort}