1
0
Fork 0
mirror of https://gitlab.com/sortix/sortix.git synced 2023-02-13 20:55:38 -05:00

Made fgetc(3) and fputc(3) use unsigned char internally.

This commit is contained in:
Jonas 'Sortie' Termansen 2012-03-07 15:51:25 +01:00
parent 2722c3f03d
commit 3cc1f7a687

View file

@ -196,14 +196,15 @@ int fcloseall(void)
int fgetc(FILE* fp)
{
char c;
if ( fread(&c, 1, sizeof(char), fp) < sizeof(char) ) { return EOF; }
unsigned char c;
if ( fread(&c, 1, sizeof(c), fp) < sizeof(c) ) { return EOF; }
return c;
}
int fputc(int c, FILE* fp)
int fputc(int cint, FILE* fp)
{
if ( fwrite(&c, 1, sizeof(char), fp) < sizeof(char) ) { return EOF; }
unsigned char c = (unsigned char) cint;
if ( fwrite(&c, 1, sizeof(c), fp) < sizeof(c) ) { return EOF; }
return c;
}