1. When stdio/stdout are redirected to files, they're not really streams as all the file operations apply to them.
(ie seek etc). And as a workaround for streams, you can make a wrapper:
Code:
uint file_sread( HANDLE file, void* _buf, uint len ) {
byte* buf = (byte*)_buf;
uint r;
uint flag=1;
uint l = 0;
do {
r = 0;
flag = ReadFile( file, buf+l, len-l, (LPDWORD)&r, 0 );
l += r;
} while( (r>0) && (l<len) && flag );
return l;
}
(This is taken from shar source)
I think its not really a problem to use such a wrapper everywhere, as the comparisons in it are much faster than actual reading anyway.
2. For interprocess communication, like you described, I prefer to use tcp.
It can be connected at any time, so the same engine can be used for all operations,
while with stdio you'd have to restart it in an app where compression is not in the main module.