2018-04-17 17:15:20 +03:00
|
|
|
#include <unistd.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
int main(int argc, char * argv[]) {
|
2018-07-17 11:08:34 +03:00
|
|
|
int fd = open(argv[1], O_WRONLY | O_CREAT | O_TRUNC, 0666);
|
2018-04-17 17:15:20 +03:00
|
|
|
|
|
|
|
while (1) {
|
|
|
|
char buf[1024];
|
|
|
|
size_t r = read(0, buf, 1024);
|
|
|
|
if (r == 0) break;
|
|
|
|
write(fd, buf, r);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|