blob: 1d6e599316df5b6a18be3e2f015b646ff5622b19 [file] [log] [blame]
/*
* fgetc.c
*/
#include "stdioint.h"
int fgetc(FILE *file)
{
struct _IO_file_pvt *f = stdio_pvt(file);
unsigned char ch;
if (__likely(f->ibytes)) {
f->ibytes--;
f->pub._io_filepos++;
return (unsigned char) *f->data++;
} else {
return _fread(&ch, 1, file) == 1 ? ch : EOF;
}
}