문제

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.

도움이 되었습니까?

해결책

Drop the struct and include stdio.h to get the typedef.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top