blob: 04d9ce02382a3ba873c83c4d3f6e0e850b86b1b4 [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;
}
}