S
salvo
Hi,
I'm having some trouble in parsing a simple text file which is formatted
as follows:
....
string\tstring\tstring\n
....
I tried to parse it with the following statments:
....
getline( file, string1, '\t' ); //first string
file.get(ch); //first \t
getline( file, string2, '\t' ); //second string
file.get(ch); //second \t
getline( file, string3, '\t' ); //third string
file.get(ch); // \n
....
As I read in some documentation, the getline doesn't put the \t in the
buffer. That's why I use the get() method. Anyhow, the file is not parsed
correctly. I tried to debug it with gdb, but I still don't get what I am
doing wrong.
Thanks in advance for any suggestion.
Regards
Salvo
I'm having some trouble in parsing a simple text file which is formatted
as follows:
....
string\tstring\tstring\n
....
I tried to parse it with the following statments:
....
getline( file, string1, '\t' ); //first string
file.get(ch); //first \t
getline( file, string2, '\t' ); //second string
file.get(ch); //second \t
getline( file, string3, '\t' ); //third string
file.get(ch); // \n
....
As I read in some documentation, the getline doesn't put the \t in the
buffer. That's why I use the get() method. Anyhow, the file is not parsed
correctly. I tried to debug it with gdb, but I still don't get what I am
doing wrong.
Thanks in advance for any suggestion.
Regards
Salvo