summaryrefslogtreecommitdiff
path: root/lib/libc/stdio/fgetc.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/stdio/fgetc.c')
-rw-r--r--lib/libc/stdio/fgetc.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/libc/stdio/fgetc.c b/lib/libc/stdio/fgetc.c
new file mode 100644
index 00000000..658eaffe
--- /dev/null
+++ b/lib/libc/stdio/fgetc.c
@@ -0,0 +1,11 @@
+#include <stdio.h>
+
+int fgetc(FILE *stream)
+{
+ int c;
+
+ if (fread(&c, 1, 1, stream) < 0)
+ return -1;
+
+ return c;
+}