iostream.blob.writen
Writes a numeric value in the given format
from "iostream" import blob
let ammo = blob(0)
ammo.writen(200, 'i')
ammo.seek(0)
println("ammo.readn('i') =", ammo.readn('i'))Output:
ammo.readn('i') = 200Parameters
value | number | the value to write |
format | int | a character selecting the type and size to write |
Errors
Throws invalid format when format is not one of the documented codes.
Notes
See iostream.stream.writen for the format codes, their sizes and the byte order used.
Writing past the current len grows this blob to fit: unlike a read past the end, a write past the end is never an error.
Example
from "iostream" import blob
let b = blob(0) // empty: writing past the end must grow it
b.writen(0x11223344, 'i')
println("b.len() =", b.len())Output:
b.len() = 4See also
writen | Writes a numeric value in the given format |
readn | Reads a value of the given numeric format and returns it |
resize | Resizes the blob to the given size |
| blob | class index |