Click to See Complete Forum and Search --> : File processing


timber
May 2nd, 1999, 05:24 PM
Hi,
I'm having trouble getting the right code to iterate through a file on disk. The file

Harvey Hawes
May 3rd, 1999, 03:36 PM
Hi,

Need more info. Explain what you are trying to do...

What are the vars declared as (I'm assuming CString and CStringList...).

Maybe use CStdioFile instead of CFile. It can read in a line of text at a time (assuming you have text files with \n's ).

If you use a CStdioFile, iterate like this


for( ; ; ) // open loop
{
if(!mystdiofile.Read(szInBuffer))
break; // eof (read returns number of chars read.... i think)

m_aMyStringList.AddTain(szInBuffer);
}




HTH,



Harvey Hawes

Software Engineer
BioScience Analysis Software Ltd.

Masters Candidate
Cardiovascular/Respiratory Sciences
Faculty of Medicine
University of Calgary
Calgary, Alberta, Canada