Drop the struct
and include stdio.h
to get the typedef.
FILE pointer incompatible with stdin
Question
I have the following code
struct FILE *in, *out;
if (argc == 1) {
/* No files were supplied so assume parsing from the stdin and printing to the stdout */
in = stdin;
out = stdout;
}
However when compiling with gcc using flags -ansi -Wall -Wextra -Werror
the following error occurs: assignment from incompatible pointer type
.
I looked up on the GNU C Library Reference Manual for the type of stdin
and on page 227 (251 on Adobe Reader) the type in indeed FILE *
so I don't know what is wrong.
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow