toaruos/userspace/extra/pipe-out.c
2015-08-06 15:01:30 -07:00

20 lines
298 B
C

#include <stdio.h>
#include <stdint.h>
int main(int argc, char * argv[]) {
if (argc < 2) {
return 1;
}
FILE * out = fopen(argv[1], "w");
while (!feof(stdin)) {
char buf[1024];
size_t r = fread(buf, 1, 1024, stdin);
fwrite(buf, 1, r, out);
}
fflush(out);
fclose(out);
return 0;
}