forked from wenjun1055/c
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path3.3.c
More file actions
30 lines (24 loc) · 658 Bytes
/
3.3.c
File metadata and controls
30 lines (24 loc) · 658 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#define BUFFSIZE 4096
#define err_sys(info) \
{ \
printf("%s\n", (info)); \
exit(-1); \
}
int main()
{
int n;
char buf[BUFFSIZE];
while ((n = read(STDIN_FILENO, buf, BUFFSIZE)) > 0) {
if (write(STDOUT_FILENO, buf, n) != n) {
err_sys("write error");
}
}
if (n < 0) {
err_sys("Read Error");
}
return 0;
}