I want to serialize and deserialize a list of objects into a file. But I found that if I use CArchive, the new content will overwrite the original content in the file, which is not my expectation. Is there any method to allow me to read and write from a specified location in the file? Thank you!
我想将对象列表序列化和反序列化为文件。但我发现如果我使用CArchive,新内容将覆盖文件中的原始内容,这不是我的期望。有没有方法允许我从文件中的指定位置读取和写入?谢谢!
1 个解决方案
#1
2
CArchive has a c'tor that takes a ptr to a CFile. Maybe if you pass it a file with the current pointer correctly set, it will do the trick.
CArchive有一个将ptr带到CFile的c'tor。也许如果你传递一个正确设置当前指针的文件,它就可以解决问题。
#1
2
CArchive has a c'tor that takes a ptr to a CFile. Maybe if you pass it a file with the current pointer correctly set, it will do the trick.
CArchive有一个将ptr带到CFile的c'tor。也许如果你传递一个正确设置当前指针的文件,它就可以解决问题。