mirror of
https://github.com/krislamo/knrc.git
synced 2024-11-10 00:30:35 +00:00
Textbook example of copying input into output
This commit is contained in:
parent
fe248c5a30
commit
dcdc220259
13
04-file-copying.c
Normal file
13
04-file-copying.c
Normal 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();
|
||||
}
|
||||
}
|
5
Makefile
5
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/*-*
|
||||
|
Loading…
Reference in New Issue
Block a user