Commit 46c85588 authored by Alberto Ramos's avatar Alberto Ramos

Add routine to check if position is at the end of the record

BDIO_eor(fb::BDIOstream)
parent f632e103
......@@ -20,7 +20,7 @@ export BDIO_BIN_GENERIC, BDIO_ASC_EXEC, BDIO_BIN_INT32BE,
# Methods
export BDIOstream, BDIO_open, BDIO_start_record!, BDIO_write_hash!,
BDIO_write!, BDIO_seek!, BDIO_get_len, BDIO_get_fmt,
BDIO_write!, BDIO_seek!, BDIO_get_len, BDIO_get_fmt, BDIO_eor,
BDIO_get_uinfo, BDIO_read, BDIO_set_user, BDIO_set_host, BDIO_close!
......
"""
BDIO_eor(fb::BDIOstream)
Checks if read/write position is at the end of the record.
## Arguments
- `fb`: A BDIOstream type. It must be associated with a file.
"""
BDIO_eor(fb::BDIOstream) = (fb.records[fb.ipt].rend == fb.rwpos)
"""
BDIO_set_user(us::String)
......@@ -99,6 +110,7 @@ Closes the file associated with fb and clears the record database
```julia-repl
julia> fb = BDIO_open("new_file.bdio", "w", "Test file")
julia> BDIO_close(fb)
```
"""
function BDIO_close!(fb::BDIOstream)
close(fb.io)
......@@ -326,8 +338,8 @@ Read a nul-terminated string from BDIO file.
## Examples
```julia-repl
julia> # Real 1000 floats from the first record of file `randoms.bdio`
julia> fb = BDIO_open("randoms.bdio", "r")
julia> # Read a string
julia> fb = BDIO_open("foo.bdio", "r")
julia> BDIO_seek!(fb)
julia> str = BDIO_read_str(fb)
```
......
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