From f3ae1721e2c0051e143d8d421e5b43bc3796269e Mon Sep 17 00:00:00 2001 From: MacroModel <33865334+MacroModel@users.noreply.github.com> Date: Wed, 27 Nov 2024 17:15:35 +0800 Subject: [PATCH] update readme --- readme.md | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/readme.md b/readme.md index 5937fd805..cd88c0656 100644 --- a/readme.md +++ b/readme.md @@ -6,19 +6,35 @@ fast_io represents a cutting-edge input/output (I/O) library for C++20, designed *Past commits were stored [here](https://bitbucket.org/ejsvifq_mabmip/fast_io_archive-2022-01-23).* ## Illustrations -### Output to `stdout` +### Output to `cstdout` ```cpp #include -int main() { +int main() +{ ::fast_io::io::print("Hello, fast_io world!\n"); + ::fast_io::io::print(::fast_io::c_stdout(), "Equivalent to the function above\n"); +} +``` +### Output to `native stdout` +* on non-windows systems (fd): (int)1 +* on win32 (handle): GetStdHandle(STD_OUTPUT_HANDLE) +* on nt (handle): RtlGetCurrentPeb()->ProcessParameters->StandardOutput +```cpp +#include + +int main() +{ + ::fast_io::io::print(::fast_io::out(), "Hello, fast_io world!\n");z } ``` ### Memory-Mapped File +* Platforms that do not support memory mapping native_file_loader will use allocator and read instead ```cpp #include -int main() { +int main() +{ ::fast_io::native_file_loader file_data{"text.txt"}; // file_data satisfies ::std::ranges::contiguous_range }