hello,
I want to get words which are split by tab('\t')
for example,
Hi my name
is ssol
is my inputfile.
and I want to split them like Hi,my,name,is,ssol.
here is my code but it doesnt work..
Can anyone give some advices?
std::string line;
while(getline(myfile1,line))
{
std::istringstream iss(line);
std::string chunk;
while(getline(iss,chunk,'\t'))
{
do something...
}
}
I want to make chunk get one word at one time..
what's wrong with this code?
"It doesn't work" means nothing. The code you posted does exactly what it says: splits text on Tab characters, and nothing else. The code ne555 posted separates on any whitespace.
If something is wrong, it is because either your expectations are off or the input you are supplying to it is not what you think.