blob: a0e8650fee56e0bc5b86ce1b5f2ce337c31e86a1 [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--;
return (unsigned char) *f->data++;
} else {
return _fread(&ch, 1, file) == 1 ? ch : EOF;
}
}