add write-out
This commit is contained in:
parent
592541ef7f
commit
a7b41bd6cc
15
apps/write-out.c
Normal file
15
apps/write-out.c
Normal file
@ -0,0 +1,15 @@
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main(int argc, char * argv[]) {
|
||||
int fd = open(argv[1], O_WRONLY | O_CREAT);
|
||||
|
||||
while (1) {
|
||||
char buf[1024];
|
||||
size_t r = read(0, buf, 1024);
|
||||
if (r == 0) break;
|
||||
write(fd, buf, r);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user