currently I\'m implementing the Burrows-Wheeler transform (and inverse transform) for raw data (like jpg etc.). When testing on normal data like textfiles no problems occur.
You can use _setmode to convert stdin to binary mode.
There is also freopen -- see this SO question