Connecting std::basic_ofstream<unsigned char> to a FIFO. bad_cast exceptions

Posted by Mike B on Stack Overflow See other posts from Stack Overflow or by Mike B
Published on 2010-06-10T16:48:21Z Indexed on 2010/06/10 16:53 UTC
Read the original article Hit count: 267

Filed under:
|
|
|

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.

© Stack Overflow or respective owner

Related posts about c++

Related posts about iostream