From da6efffb562eb678dafd2bc3b33acb706807e322 Mon Sep 17 00:00:00 2001 From: Brian Rogers Date: Wed, 1 May 2024 15:20:06 -0600 Subject: [PATCH] adding first example of character I/O --- chapter-01/2-character-io/Makefile | 2 ++ chapter-01/2-character-io/main.c | 11 +++++++++++ 2 files changed, 13 insertions(+) create mode 100644 chapter-01/2-character-io/Makefile create mode 100644 chapter-01/2-character-io/main.c diff --git a/chapter-01/2-character-io/Makefile b/chapter-01/2-character-io/Makefile new file mode 100644 index 0000000..abe7f13 --- /dev/null +++ b/chapter-01/2-character-io/Makefile @@ -0,0 +1,2 @@ +all: + gcc -o character-io.x86_64 main.c diff --git a/chapter-01/2-character-io/main.c b/chapter-01/2-character-io/main.c new file mode 100644 index 0000000..d1dc013 --- /dev/null +++ b/chapter-01/2-character-io/main.c @@ -0,0 +1,11 @@ +#include + +void main() +{ + int c; + + while ((c = getchar()) != EOF) { + putchar(c); + printf("%d", EOF); + } +}