#include<iostream>
#include<fstream>
#include<string>
#include<bitset>
using namespace std;
int main()
{
ifstream app("1.txt", ofstream::binary); // 二进制文件读取
char buf[1024]; //保存的字符串
double pos[200];
if(!app) //文件句柄不存在
{
cout << "error" << endl;
return 1;
}
app.read(buf, 1024 * sizeof(char)); //读取1024个字节
app.close(); //关闭句柄
cout << sizeof(buf) << '\t' << buf << endl;
for (int i = 0; i != 1024; i ++) //遍历读取的字节
cout << bitset<8>((unsigned int)buf[i]); //每个字节用8位的bitset表示
return 0;
}