Quirrel4.41.0

iostream.stream.flush

Method of stream, from module "iostream"
instance.flush(): int|null

Flushes the stream and returns non-null on success

Return value

1 on success, null on failure.

Notes

A blob has nothing buffered, so flush on a blob always succeeds. The same method works on a file, where it flushes the C library's write buffer for that file; it can return null there if the underlying write fails.

Example

examples/iostream/stream/flush.nut
from "iostream" import blob

let b = blob(0)
b.writen(1, 'i')
println(b.flush()) // a blob has nothing buffered to flush; this always succeeds
Output:
1

See also

flushFlushes the stream and returns non-null on success
writenWrites a numeric value in the given format
writeblobWrites the given blob and returns the number of bytes written
streamclass index