问题
我要把matlab代码转为c++
有一个dat文件,用matlab读取的代码为
fid=fopen(file,‘r’,‘ieee-be’);
c=fread(fid,‘float’);
c=reshape(c,H,W);
如何才可以用c++读取呢?
我试了方法:
char temp[sizeof(float)];
file.read(temp,sizeof(float));
读出来的数不对 挠头

问题
我要把matlab代码转为c++
有一个dat文件,用matlab读取的代码为
fid=fopen(file,‘r’,‘ieee-be’);
c=fread(fid,‘float’);
c=reshape(c,H,W);
如何才可以用c++读取呢?
我试了方法:
char temp[sizeof(float)];
file.read(temp,sizeof(float));
读出来的数不对 挠头