相关疑难解决方法(0)

使用<<运算符将二进制文件写入std :: fstream

由于某种原因,此排序代码无法正常工作:

std::fstream theFile;
theFile.open(<someFilename>, std::ios::beg |std::ios::out|std::ios::binary|std::ios::trunc);
theFile << 1;          //1 is being written as a string
int var= 25;

theFile << 25;        //same thing, 25 is written as a string
Run Code Online (Sandbox Code Playgroud)

可能是什么问题呢?我正在使用Visual Studio 2010附带的Microsoft C++编译器.

c++

5
推荐指数
1
解决办法
3673
查看次数

标签 统计

c++ ×1