1
0
mirror of https://github.com/krislamo/knrc.git synced 2024-09-19 21:00:35 +00:00

Textbook example of copying input into output

This commit is contained in:
Kris Lamoureux 2021-11-05 20:54:19 -04:00
parent fe248c5a30
commit dcdc220259
Signed by: kris
GPG Key ID: 3EDA9C3441EDA925
2 changed files with 17 additions and 1 deletions

13
04-file-copying.c Normal file
View File

@ -0,0 +1,13 @@
#include <stdio.h>
/* copy input to output; 1st version */
int main()
{
int c;
c = getchar();
while (c != EOF) {
putchar(c);
c = getchar();
}
}

View File

@ -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/*-*