#include #include #include unsigned nencode_block(char *outblock, char *inblock, unsigned len); #define IBSIZE (3*1024) /* must be divisible by 3 */ #define OBSIZE (3*2120) int n_inbuf; char inbuf[IBSIZE]; char outbuf[OBSIZE]; unsigned int fill_inbuf(int f) { n_inbuf=_read(f,inbuf,IBSIZE); if(n_inbuf<0) return 0; else return n_inbuf; } main(int argc, char **argv) { int f; if(argc!=2 || -1==(f=_open(argv[1],O_RDONLY|O_BINARY))) { fputs("RAWENC ERROR\n",stderr); return 1; } nencode_block(NULL,NULL,0); while(fill_inbuf(f)) _write(1,outbuf,nencode_block(outbuf,inbuf,n_inbuf)); _close(f); }