I am trying to read a binary file in Julia. The file contains information about positions in 3D space. I am basing my code off of a matlab script, yet when trying to reproduce the read, Julia gives me a different result. I've read through Julia's documentation, yet I cannot understand where this difference is coming from.
Here's the matlab code:
file = 'lh.white';
fid = fopen(file, 'rb', 'b');
b1 = fread(fid, 1, 'uchar');
b2 = fread(fid, 1, 'uchar');
b3 = fread(fid, 1, 'uchar');
fgets(fid);
fgets(fid);
vnum = fread(fid, 1, 'int32');
and the Julia analog:
file = "lh.white"
fid = open(file)
signature = read(fid, 3) # equivalent of 3 'uchar' from matlab
readline(fid, keep=true) # ok
readline(fid, keep=true) # ok
vnum =read(fid, Int32) # different results.
Would anyone know what could be happening here, and why vnum in Julia is a large negative number that differs from the output of matlab?
I've uploaded a dummy dataset here, if that turns out to be useful: https://filebin.net/k8sv7d8ztmucqell