#include "iostream"
#include "fstream"
#include "stdlib.h"
#include <string>
using namespace std;
int main()
{
//打开文件
ifstream infile;
infile.open("C:\\Users\\Lenovo\\source\\repos\\draw vtk file\\ReadUnknownTypeXMLFile\\F13.dat", ios::in | ios::binary);
if (!infile.is_open())
{
cout << "文件打开失败" << endl;
infile.close();
return 0;
}
//读文件
float s;
while (infile.read((char*)&s, sizeof(s))) { //一直读到文件结束
cout << s << endl;
}
//infile >> x1; //用来读取数据
infile.close(); //读取完毕,释放文件
return 0;
}
C++读二进制文件
最新推荐文章于 2024-02-27 16:45:23 发布