I am using Visual studio 2005.
i have a file that I have to read in. the text inside the file is something like this
I used getline (inStream, dump[i], ' ') to read the line and dump it into dump[i].Code:Program start integer a, b, ba=0, xx[10];
when I reached the second line it reads the whole line, from "start" until "integer". I tried to eliminate the whitespace and the tab between those 2 words. When I trim it i do it like this
it does not produce the result that I desire. I use debugger to check it, when it encounters the whitespace, the if statement does not trap that for some reason. anybody can tell me what character is that and how to eliminate it ?Code:string abc; int pos(token[i].size()); abc= token[i].c_str(); for (int m = 0 ; m < pos; m++ ){ if (abc[m] == ' ' || abc[m]=='\n' || abc == '\t') { abc.erase(m, 1); }


Reply With Quote
