searching for tabs in text file

  • Thread starter Thread starter Brian Henry
  • Start date Start date
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!
 
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
 
Back
Top