S
Surya Kiran
Hi all,
I'm facing a wierd problem.
I've a file, which is getting updated every now and then. and i'm
having another program, which monitors the file. I've to read the file
line by line, and in the end, i've to find out whether the line has
end of line character ('\n') in it or not. if its not there (that
means the line is only partially written), i've to discard it.
I'm using std::string::getline() function, with the delimiter as '\n'.
But the problem is getline does not store the '\n' (new-line
character) in the output string it generates.
ifstream fin;
string s ;
getline (fin, s, '\n');
then s does not have '\n' character in it. (even though the original
line has). I've to find out whether the original line has new-line
character in it or not.
how to do that.
Thanks in advance,
SUrya
I'm facing a wierd problem.
I've a file, which is getting updated every now and then. and i'm
having another program, which monitors the file. I've to read the file
line by line, and in the end, i've to find out whether the line has
end of line character ('\n') in it or not. if its not there (that
means the line is only partially written), i've to discard it.
I'm using std::string::getline() function, with the delimiter as '\n'.
But the problem is getline does not store the '\n' (new-line
character) in the output string it generates.
ifstream fin;
string s ;
getline (fin, s, '\n');
then s does not have '\n' character in it. (even though the original
line has). I've to find out whether the original line has new-line
character in it or not.
how to do that.
Thanks in advance,
SUrya