You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When reading from an IOStream, readbytes! reads length(b) bytes regardless of the nb.
Everything worked as expected when reading from an IOBuffer, so here is an example with a test file.
julia> f = open("testfile", "w")
write(f, collect(0x01:0x0a))
close(f);
julia> f = open("testfile")
one = zeros(Uint8, 8)
readbytes!(f, one, 3) #should be 3
8
julia> one #only first 3 bytes should be nonzero
8-element Array{Uint8,1}:
0x01
0x02
0x03
0x04
0x05
0x06
0x07
0x08
julia> seekstart(f); #reset f
julia> two = zeros(Uint8, 8)
two[1:3] = readbytes(f, 3)
two #this is what I expect "one" to be
8-element Array{Uint8,1}:
0x01
0x02
0x03
0x00
0x00
0x00
0x00
0x00
The text was updated successfully, but these errors were encountered:
When reading from an IOStream,
readbytes!
readslength(b)
bytes regardless of thenb
.Everything worked as expected when reading from an IOBuffer, so here is an example with a test file.
The text was updated successfully, but these errors were encountered: