【发布时间】:2013-03-17 18:41:48
【问题描述】:
我想将信息写入二进制文件的最后 32 个字符。但是当我调用我的 writeInfo 函数时,它会删除整个内容。我可以在写之前读取数据,但是在我用这个函数写之后,它会删除整个内容,而不是写。
void Info::writeInfo(char *filedestination)
{
ofstream test;
test.open(filedestination, ios::binary);
test.seekp(-32, ios::end); // not sure about seekp
test.write(info, 31);
test.close();
}
希望你能帮忙,谢谢
【问题讨论】:
标签: c++ file ofstream file-processing