-2
bool not_EOL (char c) {

    return ((c != '\n') && (c != '\0'));
}

while (not_EOL(gradients[i])) {
            // Read a position factor pair
            int a=sscanf(gradients + i, "(%d %lf)", &column, &factor);
            printf("%d%c",a,gradients[i]);
            if (a!=2) {
                usage(usage_message);

2 (9 100) (29 0) 38 (9 100) (49 390.043) 39 (9 100) (49 390.043) 41 (9 100) (49 390.043)

This is my not_EOL function and the file I am using. It seems that it does not detect EOL. The printf() statement prints 2(2(0, then usage() is called.

yjrye
  • 3
  • 2

1 Answers1

-1

Simplify the logic.

boo is_EOL(char c)
{
   return ((c == '\n') || (c == '\0'));
}

bool not_EOL (char c)
{
   return (!is_EOL(c));
}
R Sahu
  • 204,454
  • 14
  • 159
  • 270