while(getline (&line, &line_size, f) != -1){}
I'm using this function to read line line. But i want to know when i'm reading a blank line. Can someone help?
while(getline (&line, &line_size, f) != -1){}
I'm using this function to read line line. But i want to know when i'm reading a blank line. Can someone help?
You need to define blank line.
Also, because "The getline function reads an entire line from a stream, up to and including the next newline character."
I don't think
is portable, as Win/DOS and Unix use different convention for EOL. Also, the EOF may occur before an EOL character is done. So really, you need to define a function maybe something like
where is_eol is defined for the platform you are on. This is where you can put in whitespace can be in a blank line, etc.
So you'd get something like:
so as H2CO3 already mentioned you can use the line length for this: