write_byte
write_byte(f, b)
Input: f, b · Output: no output
What it is
Writes one raw byte to f (file handle, opened writable/appendable). b (number) must be in 0..=255, or the call errors.
Overloads
One call shape — this function is not overloaded.
| Code | Input | Output | Description |
write_byte(f, b) | f —Writes one raw byte to f (file handle, opened writable/appendable).b numberb (number) must be in 0..=255, or the call errors. | no output | — |
Examples
From the documentation, and run by the build -- the output and the figure below are what the engine actually produced. Simplest first.
f = fopen("mmap_demo.bin", "wb")
write_byte(f, 65)
write_byte(f, 66)
write_byte(f, 67)
write_byte(f, 68)
write_byte(f, 69)
write_byte(f, 70)
write_byte(f, 71)
write_byte(f, 72)
close(f)
m = mmap_open("mmap_demo.bin")
n = mmap_len(m)
first4 = mmap_read(m, 0, 4)
last4 = mmap_read(m, 4, 4)
print("n = {n}")
print("first4 = {first4}")
print("last4 = {last4}")
from tour
How it works
write_byte(f, b) — one raw byte, 0-255.
From the note above this builtin in the interpreter, where the reasoning was written down as it was built.