libc: Partially implement ungetc
This commit is contained in:
parent
51580bb846
commit
d75de5f423
@ -170,9 +170,14 @@ extern "C"
|
||||
return fgetc(stdin);
|
||||
}
|
||||
|
||||
int ungetc(int, FILE*)
|
||||
int ungetc(int c, FILE* stream)
|
||||
{
|
||||
NOT_IMPLEMENTED("ungetc");
|
||||
if (stream->f_bufoff > 0)
|
||||
{
|
||||
stream->f_bufoff--;
|
||||
stream->f_buf[stream->f_bufoff] = (char)c;
|
||||
}
|
||||
else { NOT_IMPLEMENTED("ungetc with buffer that has not been read"); }
|
||||
}
|
||||
|
||||
int ferror(FILE* stream)
|
||||
|
Loading…
Reference in New Issue
Block a user