_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.11.0 (2024-10-07)
_/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |
julia> function mwe(filepath, nb, max_nb)
write(filepath, ones(UInt8, nb))
p = open(`cat $filepath`; read=true)
b = Vector{UInt8}(undef, 1024)
nr = readbytes!(p, b, max_nb)
return nr, b
end
mwe (generic function with 1 method)
julia> (nr, v) = mwe("/Users/edavies/Downloads/tmp.bin", 53209, typemax(Int))
(53209, UInt8[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 … 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00])
julia> length(v)
1024
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.10.5 (2024-08-27)
_/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |
julia> function mwe(filepath, nb, max_nb)
write(filepath, ones(UInt8, nb))
p = open(`cat $filepath`; read=true)
b = Vector{UInt8}(undef, 1024)
nr = readbytes!(p, b, max_nb)
return nr, b
end
mwe (generic function with 1 method)
julia> (nr, v) = mwe("/Users/edavies/Downloads/tmp.bin", 53209, typemax(Int))
(53209, UInt8[0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 … 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00])
julia> length(v)
118745
On 1.11:
On 1.10: