searching for tabs in text file

B

Brian Henry

I'm reading in a text file usein fstream, and I want to look for where
fields are split up by tab seperators. (tab delimited) and read it into the
app, now the fields are variable length characters (how do i read in a
variable length char field?) and how do i tell where the tabs are seperating
the fields? It's been a while since i wrote in c++, thanks!
 
J

Jochen Kalmbach

Brian said:
I'm reading in a text file usein fstream, and I want to look for where
fields are split up by tab seperators. (tab delimited) and read it
into the app, now the fields are variable length characters (how do i
read in a variable length char field?) and how do i tell where the
tabs are seperating the fields? It's been a while since i wrote in
c++, thanks!

For managed C++:
Read the file line by line (TextReder.ReadLine)

Then split the string using
string[] sl = string.Split("\t");
Now you have an array of strings.


For normal C/C++:
You have to do the abouve thing by hand (manybe you can use STL to help
you; but there is a problem with getline...)

--
Greetings
Jochen

Do you need a memory-leak finder ?
http://www.codeproject.com/useritems/leakfinder.asp
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top