根据 fgetc(FILE*) 实现,我找不到 FILE 结构的 ungetcflag 成员

I cannot find the ungetcflag member of FILE structure according to fgetc(FILE*) implementation

这是函数int fgetc(FILE* fp)根据这个link的实现。 mirror.fsf.org

#include <stdio.h>
#include <unistd.h>

/**  fgetc(fp) -- get char from stream */

int fgetc(FILE *fp)
{
    char c;

    if (fp->ungetcflag) {
        fp->ungetcflag = 0;
        return (fp->ungetchar);
    }
    if (read (fp->fd, &c, 1) == 0)
        return (EOF);
    return (c);
}

我试着查看 stdio.h 和 google 中 FILE 的定义,但找不到成员 ungetcflagungetchar

这是什么意思?

评论足以回答。

那是 实现 fgetc(),而不是 实现 fgetc)_
具体来说,不是 fgetc() 的实现,它是您的 libc,因此代码与 <stdio.h> 中的 FILE 定义不匹配。