I need to do something like this for my program's input:
stream input;
if (decompressed)
input.open(filepath);
else {
file_descriptor=_popen("decompressor "+filepath,"r");
input.open(file_descriptor);
}
input.read(...)
...
I can see 1 solution... to use _popen in both cases and just copy the file to stdout if it's already decompressed, but this doesn't seem very elegant.
Funny how difficult this is compared with C, I guess the standard library missed it. Now I am lost in the cryptic boost::iostreams documentation. Example code would be great if anyone knows how.