Reading a raw data file, getting different values ​​in Matlab and C ++

I am converting code from Matlab (which I am not familiar with) into C ++. Part of the code is read in a raw data file and injects every 8 bits into the matrix element.

MATLAB:

header=fread(fid, 512, '*uint8');

Similarly, in C ++, I have:

fread(&q1[0][0], sizeof(uint8_t), 512, filepath);

They both read the same file, and the values ​​they flatten out correspond to element 33.

10
0
0
0
244
1
0
0
10
0
0
0
244
1
0
0
10
0
0
0
244
1
0
0
10
0
0
0
208
7
0
0

Then my C ++ program spits out “92” while my Matlab code spills out at 180. The values ​​start to diverge:

C++ / MATLAB
92 / 180
58 / 118
230 / 219
60 / 133

and continue without matching for the remaining 512 bytes.

Any ideas as to what could be causing this?

+3
source share
2 answers

, Matlab , , . "" ( ), , .

0

++ 'b' ? 't', , / -.

: , Windows. Windows, .

+1

All Articles