我有使用 MFC CArchive 从序列化 C++ 对象生成的二进制文件。我想编写Python代码来读取这些二进制文件。
Python 或 pyqt 中可以读取 snd 反序列化文件的等效函数或类是什么?
我看过QTQDataStream类,但我不知道它是否与CArchive类似。
谢谢
我试图用C#读入一个用CArchive编写的文件.据我所知,格式是:
[下一组数据的长度] [数据] ......等
不过,我对某些数据仍然很模糊.如何阅读日期数据?浮标,整数,双打等怎么样?
此外,[下一组数据的长度]可以是字节或字或双字.我怎么知道它们各自的时间?例如,对于字符串"1.10",数据是:
04 31 2e 31 30
Run Code Online (Sandbox Code Playgroud)
该04是长度,显然和其余为1.10十六进制值.不重要的.后来我有一个41个字符长的字符串,但[length]值是:
00 00 00 29
Run Code Online (Sandbox Code Playgroud)
为什么长度为4个字节?(0x29 = 41)
主要问题是:CArchive输出的格式是否有规范?
This might sound basic but:
WORD wSong = 0;
CArchive ar;
...
ar >> wSong;
m_sPublicTalkInfo.iSongStart = static_cast<int>(wSong);
Run Code Online (Sandbox Code Playgroud)
At the moment I read the WORD into a specific variable and the cast it.
Can I read it in and cast at the same time?
Please note I can't serialize a int. It must be a WORD and cast to int.
Or
ar >> wSong;
m_sPublicTalkInfo.iSongStart = static_cast<int>(wSong);
Run Code Online (Sandbox Code Playgroud) CArchive如果我们不知道文件中存储什么类型的对象,有什么方法可以从CArchive文件中检索信息吗?
我想知道信息以什么格式存储在CArchive文件中。
请帮我解决这个问题。