references/sleep-functions/reset.md

GitHub

reset

Category: InputOutput

Source: https://sleep.dashnine.org/manual/reset.html


Synopsis

reset([$handle])

resets this IO stream back to the last &mark

Parameters

$handle - the handle to reset the mark for

Examples

Example:

$buffer = allocate();
writeb($buffer, "this.is.an.example");
closef($buffer);

println("Read: " . readb($buffer, 4));
mark($buffer);

println("Read: " . readb($buffer, 4));
reset($buffer);

println("Read: " . readb($buffer, -1));

Output:

Read: this
Read: .is.
Read: .is.an.example

See Also

&available; &closef; &consume; &mark; &printEOF; &setEncoding; &skip; &wait