I was wondering how to read a fixed-length character string from a binary file. My file is formatted like this:
Int32|4-byte string|array of Float32's . . .
The string consists of just four plain ASCII characters without null termination.
So far, I’ve been successful in reading the first integer
open("datafile.dat", "r") do io
header = read(io, Int32)
println(header)
str = read(io, 4) # four-byte string
println(str)
end
For the string, I get a Vector{UInt8}. So, how do you convert it to a String?