#include #include #include // Needed on mingw/win32 // // usage: bcat.exe FILE | videoshow ... -stdin main(int argc, char *argv[]) { unsigned char buffer[32768]; int i,n; int out; unsigned int total=0; int fd; fd = open(argv[1],O_RDONLY|O_BINARY); while(1) { n = read(fd,buffer,32768); if (n <= 0) break; // why do I need to do this??? for(i=0; i0) { int m = write(1,buffer+out,n); if (m<0) { break;} n -= m; out += m; total+= m; } } fprintf(stderr,"Piped %d bytes\n",total); }