I have a binary file i am reading out with julia. In the file header there is a large ‘setup’ structure with data of many different types. One of the data types is an array of char (8-bit signed integer) terminated by a 0 byte. I am given the size of the array (121). i am not sure how to implement the parsing code in julia. Here is a snippet of the code i have writen so far:
function cineheader(fname)
h = OrderedDict()
open(fname) do f
# Check magic number
read(f, UInt16) == UInt(18755) || error(basename(fname), " is not a .cine file")
fhtypes = OrderedDict( # File header
:HeadSize => UInt16,
:Compression => UInt16,
:Version => UInt16,
:FirstImageIndex => Int32,
:TotalImages => UInt32,
:FirstImageNum => Int32,
:ImCount => UInt32,
:OffImageHeader => UInt32,
:OffSetup => UInt32,
:OffImageOffset => UInt32,
:TriggerFrac => UInt32,
:TriggerSec => UInt32
:DescriptionOld => **array of char terminated by a 0 byte**
)
for (ID, headertype) in fhtypes # Read .cine file header
h[ID] = read(f, headertype)
end
end