New repo setup
This commit is contained in:
21
src/stdio/fgetc.c
Normal file
21
src/stdio/fgetc.c
Normal file
@@ -0,0 +1,21 @@
|
||||
#include "stdio.h"
|
||||
#include <sys/syscall.h>
|
||||
|
||||
int fgetc(FILE *stream)
|
||||
{
|
||||
char c;
|
||||
int check;
|
||||
check = read(*stream, &c, 1);
|
||||
if (check < 0)
|
||||
{
|
||||
return -1; // eof
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
int fputc(int ch, FILE *stream)
|
||||
{
|
||||
char c = ch;
|
||||
write(*stream, &c, 1);
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user