Connecting std::basic_ofstream<unsigned char> to a FIFO. bad_cast exceptions
- by Mike B
Using gcc 4.4.3 on Linux 2.6.32, I get bad_cast exceptions when connecting std::basic_ofstream to a FIFO.
Stepping though the debugger, I can see that the error is generated at various places in the standard library because the _M_codecvt member of the stream or filebuf object is NULL. Exactly where it happens depends on the order of operations, but it appears to be the same cause in each.
So am I doing something fundamentally stupid here? ofstream and ifstream work fine. Is there some reason that you shouldn't attach a stream of anything besides char to a FIFO?
Thanks in advance.