| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
The io module provides a simple, modern, and cross-platform API for working with input and output streams in C++.
It is designed to be:
I/O in Vix follows strict principles:
The goal is to bring a modern developer experience to C++ I/O.
Using Vix:
vix add @vix/io#include <vix/io/Io.hpp>
int main()
{
auto out = vix::io::stdout_stream();
vix::io::write_line(out, "Hello Vix IO");
}auto in = vix::io::stdin_stream();
auto out = vix::io::stdout_stream();
auto err = vix::io::stderr_stream();auto line = vix::io::read_line(in);
if (line)
{
vix::io::write_line(out, line.value());
}auto data = vix::io::read_all(in);
if (data)
{
vix::io::write(out, data.value());
}auto chunk = vix::io::read(in, 1024);vix::io::write(out, "Hello");
vix::io::write_line(out, " world");vix::io::Bytes bytes{65, 66, 67};
vix::io::write(out, bytes);vix::io::flush(out);auto result = vix::io::copy(in, out);
if (!result)
{
vix::io::write_line(err, "copy failed");
}vix::io::Buffer buffer;
buffer.append("Hello ");
buffer.append("Buffer");
vix::io::write_line(out, buffer.to_string());vix::io::IoOptions options;
options.chunk_size = 8192;
options.auto_flush = true;Used in:
All operations return a Result<T>.
auto result = vix::io::read_line(in);
if (!result)
{
std::cerr << result.error().message() << "\n";
return;
}using Bytes = std::vector<std::uint8_t>;vix::io::Buffer buffer;
buffer.append("data");See the examples/ directory:
Traditional C++ I/O:
Vix IO provides:
MIT License
| Back | FazBrowse Home | New Git URL |