Qu

write_int32

Builtin index · File I/O

write_int32(f, n, [endian=])

Input: f, n, endian · Output: no output

What it is

Writes n (number) to f (file handle, opened writable/appendable) as a signed 32-bit integer. endian (string, optional, default "little", or "big") selects byte order.

Overloads

One call shape — this function is not overloaded.

CodeInputOutputDescription
write_int32(f, n, [endian=])
f numberWrites n (number) to f (file handle, opened writable/appendable) as a signed 32-bit integer.
n numberWrites n (number) to f (file handle, opened writable/appendable) as a signed 32-bit integer.
endian string, optionalendian (string, optional, default "little", or "big") selects byte order.
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("record.bin", "wb")
write_int32(f, 12345)
write_float(f, 3.5)
close(f)

g = fopen("record.bin", "rb")
n = read_int32(g)
x = read_float(g)
close(g)
print("n = {n}, x = {x}")
output
n = 12345, x = 3.5

from file-io