summaryrefslogtreecommitdiff
path: root/src/stream_stdio.c
diff options
context:
space:
mode:
authorAditya Naik2020-07-30 14:16:20 -0400
committerAditya Naik2020-07-30 14:16:20 -0400
commitc8c06aea5199e555235f71acc8547ed2ef0706cf (patch)
treee1d72f836873c9fc99dd200dd8829c6f0046b96f /src/stream_stdio.c
parent70f623d66439a826927b7d2fc9d64ae0cb631b92 (diff)
Stream abstraction
Diffstat (limited to 'src/stream_stdio.c')
-rw-r--r--src/stream_stdio.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/stream_stdio.c b/src/stream_stdio.c
new file mode 100644
index 0000000..efa4b13
--- /dev/null
+++ b/src/stream_stdio.c
@@ -0,0 +1,18 @@
+#include <stdio.h>
+#include "stream_stdio.h"
+#include "stream.h"
+
+int stdio_read(uint8_t* buf, size_t count, void **vptr, void *sptr)
+{
+ int x;
+ for (x = 0; x < count; x++) {
+ scanf("%c", &buf[x]);
+ }
+ return 0;
+}
+
+int stdio_write(uint8_t* buf, size_t count, void **vptr, void *sptr)
+{
+ printf("%s\n", buf);
+ return 0;
+}