T
Terry IT
hi,
i'm using code like this
string s
while(getline(cin,s)){
process(s);
}
// this is the last line
process(s);
process does some replacement and rescanning. The problem is i can't
strip or add newlines. So i don't know whether the lastline contains a
'\n' or it was just EOF.
I can't read the whole buffer as it is too huge and some line doesn't
need to be replaced.
Using while(fgets(str,MAX,stdin){
s=str
}
works but again this conversion of str to s is an overhead.
Can you suggest on how to overcome on this getline issue ?
i'm using code like this
string s
while(getline(cin,s)){
process(s);
}
// this is the last line
process(s);
process does some replacement and rescanning. The problem is i can't
strip or add newlines. So i don't know whether the lastline contains a
'\n' or it was just EOF.
I can't read the whole buffer as it is too huge and some line doesn't
need to be replaced.
Using while(fgets(str,MAX,stdin){
s=str
}
works but again this conversion of str to s is an overhead.
Can you suggest on how to overcome on this getline issue ?