compat.mio
#includemio — cross-platform header-only memory-mapped file IO
#include <mio/mmap.hpp>
mcpp add compat.mio@2023.3.3
用法
來自本倉庫自己的測試專案 —— CI 真的編譯並執行過,不是為了網站寫的。
// Behavioral test — compat.mio actually maps a file.
//
// The test writes its own file into the working directory, maps it, reads
// through the mapping and then writes through a second mapping. Nothing here
// depends on the runner's filesystem layout beyond "can create a file", which
// is true on all three CI platforms.
#include <mio/mmap.hpp>
#include <cstdio>
#include <fstream>
#include <string>
#include <system_error>
int main() {
const std::string path = "mcpp_mio_test.bin";
const std::string payload = "mcpp-index mio round trip";
{
std::ofstream out(path, std::ios::binary | std::ios::trunc);
out.write(payload.data(), static_cast<std::streamsize>(payload.size()));
}
// …
tests/examples/mio/tests/mmap.cpp · 專案 tests/examples/mio
建置
- targets
mio (lib)- language
c++23- C standard
c11- import std
- no
- include dirs
*/include
原始檔 (1)
mcpp_generated/mio_anchor.c
產生的檔案
mcpp_generated/mio_anchor.c