1 #include <stdio.h>
2 #include <io_utils.h>
3 #include <errno.h>
4 #include <string.h>
5
6 void ReadFile1() {
7 FILE *file = fopen("CMakeLists.txt", "r");
8 if (file) {
9 char buffer[BUFSIZ];
10 while (fgets(buffer, BUFSIZ, file)) {
11 printf(buffer);
12 }
13 fclose(file);
14 } else {
15 PRINT_INT(errno);
16 puts(strerror(errno));
17 perror("fopen");
18 }
19 }
20
21 void Echo() {
22 char buffer[4];
23 while (1) {
24 if (!fgets(buffer, 4, stdin)) {
25 break;
26 }
27 //puts(buffer);
28 printf("%s", buffer);
29 }
30 }
31
32 int main() {
33 Echo();
34 // ReadFile1();
35 return 0;
36 }