Is there a way to check if an istream was opened in binary mode?

后端 未结 2 1516
慢半拍i
慢半拍i 2020-12-06 09:52

I\'m using an istream which could be stringstream, ifstream or a user-defined stream type and I need to know if, in the case of an ifstream, it was not opened in binary mode

相关标签:
2条回答
  • 2020-12-06 10:03

    Nope, there is no way to test this.

    0 讨论(0)
  • 2020-12-06 10:21

    flags() returns ios_base::fmtflags which is formatting flags, whereas binary is an ios_base::openmode flag. I'm not sure if there is a way to find these out once the stream is already open. I was thinking that maybe there was a virtual member of the streambuf class that could help, but there doesn't really seem to be.

    0 讨论(0)
提交回复
热议问题