std::ostream to QDataStream

后端 未结 1 1343
闹比i
闹比i 2020-12-12 00:56

I have overloaded \'<<\' operator for MyClass.

friend std::ostream& operator << (std::ostream& out, const MyClass& Obj);
相关标签:
1条回答
  • 2020-12-12 00:59

    You can't just convert one into the other. But you can use QBuffer as a workaround. It is a QIODevice, so you can create a QDataStream from it. When done writing your data, get the QByteArray from the buffer and use its data to write to your std::ostream.

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