Add pipe-out which acts as > for pipes

This commit is contained in:
Kevin Lange 2015-08-06 15:01:30 -07:00
parent 49a4251830
commit 2e65c8667f

View File

@ -0,0 +1,19 @@
#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;
}