How do you read structures from a file?

From the OP’s description, @Zweta_Fuze is reading strings consisting of 13 ASCII characters (or 13 UTF-8 code units), and not 13 Chars`. So you need:

struct Frame
    s::NTuple{13,UInt8}
    n::NTuple{10,Int16}
    x::NTuple{20,Float32}
end

But you will still run into a problem with struct padding — the compiler pads Frame with 3 extra bytes so that n starts on a 32-bit word boundary.

1 Like