c - Fgets compilation error -
i'm stuck seems beginner's compilation error:
my simple program:
#include <stdlib.h> #include <stdio.h> #include "tiles_circular_linked_list.h" #define max_line_length 128; int main(int argc, char **argv) { struct node *head_tail; file *file; /*char filename[] = "/home/student/desktop/studies/c/testing_fodder/tiles";*/ argv++; /*go second character-array argument*/ file = fopen(*argv, "r"); char *curr_line; fgets(curr_line, max_line_length, file); return 0; }
i try compile using command:
gcc -g -wall -ansi launch_tiles.c -o tiles_prog
and these errors:
launch_tiles.c: in function ‘main’:
launch_tiles.c:17:19: error: expected ‘)’ before ‘;’ token
launch_tiles.c:17:19: error: few arguments function ‘fgets’ /usr/include/stdio.h:628:14: note: declared here
launch_tiles.c:9:8: warning: variable ‘file’ set not used [-wunused-but-set-variable]
launch_tiles.c:8:15: warning: unused variable ‘head_tail’ [-wunused-variable]
i interested errors, not warnings.
i can count 3 arguments pass fgets
, don't understand miss parentheses what's problem?
thanks!
change
#define max_line_length 128;
to
#define max_line_length 128
(without ;
). easy mistake make.
the c preprocessor simple, textual substitution, wrongly-defined macro, end with
fgets(curr_line, 128;, file);
which syntax error.
Comments
Post a Comment