Hi, I'm getting two spaces instead of just one and this is not good!
The differences occur when there is just a blank line.
So if we had a file:
Code:
/* everything is good */
/* everything is good */
/* I'm a space ahead of where I am now if you output me with the below code */
Here's the code:
Code:
while ( EOF != (inChar = getc(inFile)) ) {
if ( (column >= options.width) ) {
if ('\n' != outLine[offset-1] ) {
outLine[offset++] = '\n';
}
fwrite(outLine, sizeof(char), offset, stdout);
memset(outLine, '\0', 65535);
offset = lastBlank = thereWasASpaceInThisLine = column = 0;
}
outLine[offset++] = inChar;
column = incColumn(&column, inChar, options);
if ( '\n' == inChar ) {
thereWasASpaceInThisLine = FALSE;
column = options.width;
}
}