blob: 353e2cac670e40c0653fcd26ae5262e222322bb4 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
const size_t BUFF_SIZE = 1024;
int main(int argc, char* argv[]) {
int fd_in = 0;
if (argc > 1)
fd_in = open(argv[1], O_RDONLY);
char buf[BUFF_SIZE];
int actual = read(fd_in, buf, BUFF_SIZE);
while (actual > 0) {
printf("%s", buf);
actual = read(fd_in, buf, BUFF_SIZE);
}
return 0;
}
|