Click to See Complete Forum and Search --> : File I/O


C B
June 8th, 1999, 01:30 AM
Hey.

I have a tab-delimited text-file with entries i want to read from. The data consists of two strings per post which i want to read and then manipulate with. What functions is best to use?

A record could look like this:

Accolade <tab> Something_generic_here
etc..

Thanks!

C B

Jason Teagle
June 8th, 1999, 01:41 AM
Use CStdioFile. Construct it (no parameters), use its Open() method with the filename and CFile::modeRead|CFile::typeText as the attributes, then use its ReadString() method to read the line as a CString. Use CString's TrimRight() to remove the trailing <CR><LF>. Then use CString's Find() method to locate the index of the <TAB> ('\t'), and use CString's Left() and Right() methods to split the line into its two halves.

Does this help?

C B
June 8th, 1999, 01:52 AM
Thanks very much

C B