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:
parent
2722c3f03d
commit
3cc1f7a687
1 changed files with 5 additions and 4 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue