mirror of
https://gitee.com/zlgopen/awtk.git
synced 2024-12-02 20:18:22 +08:00
1.2 KiB
1.2 KiB
ostream 扩展函数
1.ostream_seek
2.ostream_tell
3.ostream_flush
4.ostream_write_uint8
5.ostream_write_uint16
6.ostream_write_uint32
7.ostream_write_uint64
8.ostream_write_int8
9.ostream_write_int16
10.ostream_write_int32
11.ostream_write_int64
12.ostream_write_float
13.ostream_write_double
14.ostream_write_string
15.ostream_write_binary
更多示例
a = ostream_file_create("test.bin", "wb+")
assert(ostream_write_uint8(a, 1) == 1)
assert(ostream_write_int8(a, -1) == 1)
assert(ostream_tell(a), 2)
assert(ostream_write_uint16(a, 2) == 2)
assert(ostream_write_int16(a, -2) == 2)
assert(ostream_tell(a), 6)
assert(ostream_write_uint32(a, 3) == 4)
assert(ostream_write_int32(a, -3) == 4)
assert(ostream_tell(a), 14)
assert(ostream_write_uint64(a, 4) == 8)
assert(ostream_write_int64(a, -4) == 8)
assert(ostream_tell(a), 30)
assert(ostream_write_float(a, 5) == 4)
assert(ostream_write_double(a, -5) == 8)
assert(ostream_tell(a), 42)
assert(ostream_write_string(a, "hello") == 5)
assert(ostream_write_binary(a, "world", 5) == 5)
assert(ostream_tell(a), 52)
assert(ostream_flush(a))