Hello Everyone ,
I am trying to pase csv file and populate my stucture. But some how I have blank line in between and would like to skip those lines.
Can anyone please suggest some solution. Thanks in advance :
It seems fairly simple. If not, isn't it just a matter of adding a couple of lines of code at the top of your while loop? Just test the szLine before you copy it. Loop until you find a non-whitespace character and then don't perfrom the strcpy if you detect that the line is blank. By blank I assume it means that szLine is either a null string or it just has a few spaces correct?
Hi ,
Thanks for that reply but still did not get it.
szLine is declared as CHAR szLine[4096]. And as soon as I get a complete blank line my program crush.
I still not sure how to check szLine for a blank line .. Appreciate your help..
fgets() will put the newline of an empty line in the buffer, so testing for strlen() == 0 won't work. Check if the first character in szLine is a 0, newline or carriage return.