write_int
write_int(f, value, [bytes=4], [signed=true], [endian="little"])
Input: f, value, bytes, signed, endian · Output: no output
What it is
The mirror of read_int, writing value (a number) to f (file handle, opened writable/appendable) in the given width and byte order. Unlike write_int16/write_int32, this checks that value fits and errors if it does not, rather than silently wrapping: bytes=/signed= are runtime values that can come from a variable, so a wrapped result here would be far harder to notice than picking the wrong fixed-width function.
Overloads
One call shape — this function is not overloaded.
| Code | Input | Output | Description |
write_int(f, value, [bytes=4], [signed=true], [endian="little"]) | f numberThe mirror of read_int, writing value (a number) to f (file handle, opened writable/appendable) in the given width and byte order.value numberThe mirror of read_int, writing value (a number) to f (file handle, opened writable/appendable) in the given width and byte order.bytes optional (default 4)Unlike write_int16/write_int32, this checks that value fits and errors if it does not, rather than silently wrapping: bytes=/signed= are runtime values that can come from a variable, so a wrapped result here would be far harder to notice than picking the wrong fixed-width function.signed optional (default true)Unlike write_int16/write_int32, this checks that value fits and errors if it does not, rather than silently wrapping: bytes=/signed= are runtime values that can come from a variable, so a wrapped result here would be far harder to notice than picking the wrong fixed-width function.endian optional (default "little")not documented yet | no output | — |
Examples
No documentation example calls this form yet. The File I/O chapter is where one belongs.