2017-02-08 01:06:50 +01:00
|
|
|
#include <ostd/platform.hh>
|
2016-02-02 00:10:05 +01:00
|
|
|
#include <ostd/io.hh>
|
2016-01-31 23:19:23 +01:00
|
|
|
|
|
|
|
using namespace ostd;
|
|
|
|
|
2017-01-30 19:19:09 +01:00
|
|
|
void print_result(uint32_t x) {
|
2016-01-31 23:19:23 +01:00
|
|
|
writefln("got x: 0x%X", x);
|
|
|
|
}
|
|
|
|
|
|
|
|
int main() {
|
2017-02-16 20:39:05 +01:00
|
|
|
file_stream wtest{"test.bin", stream_mode::WRITE};
|
2016-07-31 21:40:25 +02:00
|
|
|
copy(
|
|
|
|
iter({ 0xABCD1214, 0xBADC3264, 0xDEADBEEF, 0xBEEFDEAD }),
|
2017-01-30 19:19:09 +01:00
|
|
|
wtest.iter<uint32_t>()
|
2016-07-31 21:40:25 +02:00
|
|
|
);
|
2016-01-31 23:19:23 +01:00
|
|
|
wtest.close();
|
|
|
|
|
2017-02-16 20:39:05 +01:00
|
|
|
file_stream rtest{"test.bin"};
|
2016-02-26 16:19:54 +01:00
|
|
|
writefln("stream size: %d", rtest.size());
|
2016-01-31 23:19:23 +01:00
|
|
|
|
2017-02-16 20:39:05 +01:00
|
|
|
for (uint32_t x: map(rtest.iter<uint32_t>(), from_big_endian<uint32_t>())) {
|
2016-01-31 23:19:23 +01:00
|
|
|
print_result(x);
|
2016-07-31 21:40:25 +02:00
|
|
|
}
|
2016-01-31 23:19:23 +01:00
|
|
|
|
|
|
|
return 0;
|
2016-02-07 22:17:15 +01:00
|
|
|
}
|