Commit f632e103 authored by Alberto Ramos's avatar Alberto Ramos

Add routine to read a nul-terminated string

parent 51191c7a
......@@ -316,6 +316,32 @@ function BDIO_read(fb::BDIOstream, vdata::Vector, n::Int64 = 0)
Read a nul-terminated string from BDIO file.
## Arguments
- `fb`: A BDIOstream type. It must be associated with a file.
## Examples
julia> # Real 1000 floats from the first record of file `randoms.bdio`
julia> fb = BDIO_open("randoms.bdio", "r")
julia> BDIO_seek!(fb)
julia> str = BDIO_read_str(fb)
function BDIO_read_str(fb::BDIOstream)
rpos::Int64 = max(fb.records[fb.ipt].rpos, fb.rwpos)
str::String = readuntil(, '\0')
fb.rwpos = position(
return str
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment