read_uint64
result = read_uint64(f, [endian=])
Input: f, endian · Output: result
What it is
Reads an unsigned 64-bit integer from f (file handle, opened readable). endian (string, optional, default "little", or "big") selects byte order.
Overloads
One call shape — this function is not overloaded.
| Code | Input | Output | Description |
result = read_uint64(f, [endian=]) | f —Reads an unsigned 64-bit integer from f (file handle, opened readable).endian string, optionalendian (string, optional, default "little", or "big") selects byte order. | result number | Returns a number, or Nothing if fewer than 8 bytes remain. Same 2^53 exact-precision ceiling as read_int64. |
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("sample64.bin", "wb")
write_int64(f, -123456789012)
write_uint64(f, 9007199254740993) # 1 past 2^53 -- the exact-precision edge
close(f)
g = fopen("sample64.bin", "rb")
a = read_int64(g)
b = read_uint64(g)
close(g)
print("{a} {b}") # -123456789012 9007199254740992 -- rounded
M = [1, 2, 3; 4, 5, 6]
write_array("matrix.bin", M, type = "int32")
back = read_array("matrix.bin", type = "int32") -> (2, 3)
print(back) # [1, 2, 3; 4, 5, 6] -- shape recovered via reshape
output
-123456789012 9007199254740992 [1, 2, 3; 4, 5, 6]
from file-io