diff --git a/04-file-copying.c b/04-file-copying.c new file mode 100644 index 0000000..5c7e6f2 --- /dev/null +++ b/04-file-copying.c @@ -0,0 +1,13 @@ +#include + +/* copy input to output; 1st version */ +int main() +{ + int c; + + c = getchar(); + while (c != EOF) { + putchar(c); + c = getchar(); + } +} diff --git a/Makefile b/Makefile index 3fcaad8..e70c2c4 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -all: hello mathvars c2f +all: hello mathvars c2f input hello: 01-hello-world.c gcc -o ./bin/01-helloworld 01-hello-world.c @@ -9,5 +9,8 @@ mathvars: 02-vars-and-math.c c2f: 03-celsius-to-fahrenheit.c gcc -o ./bin/03-c2f 03-celsius-to-fahrenheit.c +input: 04-file-copying.c + gcc -o ./bin/04-input 04-file-copying.c + clean: $(RM) ./bin/*-*