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.
As you've noticed, you're reading from stdin
in ASCII mode and it is hitting the SUB character (substitute, aka CTRL+Z, aka DOS End-of-File).
You have to change the mode to binary with setmode while on Windows:
#if defined(WIN32)
#include
#include
#endif /* defined(WIN32) */
/* ... */
#if defined(WIN32)
_setmode(_fileno(stdin), _O_BINARY);
#endif /* defined(WIN32) */
On platforms other than Windows you don't run into this distinction in modes.