FILE指针与stdin不兼容

时间:2014-02-08 22:30:02

标签: c gcc stdin

我有以下代码

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;
}

但是,当使用标记-ansi -Wall -Wextra -Werror使用gcc进行编译时,会出现以下错误:assignment from incompatible pointer type

我在GNU C Library Reference Manual上查找了stdin的类型,在第227页(Adobe Reader上的251)查找了FILE *中的类型,所以我不知道出了什么问题

1 个答案:

答案 0 :(得分:2)

删除struct并添加stdio.h以获取typedef。