iostream.stream.tell
Returns the current stream position
Return value
The cursor's offset from the start of the stream, in bytes.
Notes
seek moves the cursor directly; readn, writen, readblob, writeblob, readobject and writeobject move it by however many bytes they consume or produce. The same method works on a file.
Example
from "iostream" import blob
let b = blob(4)
println("b.tell() at start =", b.tell()) // starts at 0
b.readn('i')
println("b.tell() after readn('i') =", b.tell()) // advanced by the 4 bytes just read
b.seek(1)
println("b.tell() after seek(1) =", b.tell())
b.writen(1, 'c')
println("b.tell() after writen('c') =", b.tell()) // advanced by the 1 byte just writtenOutput:
b.tell() at start = 0
b.tell() after readn('i') = 4
b.tell() after seek(1) = 1
b.tell() after writen('c') = 2See also
tell | Returns the current stream position |
seek | Seeks to the given offset; origin is 'b' (begin), 'c' (current) or 'e' (end) |
len | Returns the stream length |
| stream | class index |