Sane C++ Libraries
C++ Platform Abstraction Libraries
File

Table of Contents

🟩 Synchronous Disk File I/O

File library allows synchronous I/O operations on files and pipes.

Features

SC::FileDescriptor File Descriptor (use SC::File to open and use it with strings and containers).
SC::FileDescriptor::read Reads bytes at offset into user supplied span.
SC::FileDescriptor::write Writes bytes at offset from start of the file descriptor.
SC::FileDescriptor::seek Changes the current position in the file descriptor, if seekable.
SC::File Wraps a SC::FileDescriptor to open it and use strings / containers.
SC::File::open Opens file at path with a given mode
SC::File::readUntilEOF Reads into a given dynamic buffer until End of File (EOF) is signaled.
SC::PipeDescriptor Read / Write pipe (Process stdin/stdout and IPC communication)
SC::PipeDescriptor::readPipe The read side of the pipe.
SC::PipeDescriptor::writePipe The write side of the pipe.

Status

🟩 Usable
This library has a relatively limited scope and it should not need many additional features compared to now.
Will consider bumping to Complete in the future.

Description

SC::FileDescriptor object can be created by SC::FileDescriptor::open-ing a path on file system and it can be SC::FileDescriptor::read or SC::FileDescriptor::write.
Also non-blocking mode can be controlled with SC::FileDescriptor::setBlocking.
A file can be marked as inheritable with SC::FileDescriptor::setInheritable so that in can be accessed by child processes. SC::PipeDescriptor creates a pipe for InterProcess communication.
A pipe has read and write SC::FileDescriptor endpoints and it's used by Process library to redirect standard input, output or error to other processes.
It can also be used to read or write the standard input, output or error from current process into a binary buffer or a string (as done by SC::ProcessChain::readStdOutUntilEOFSync or other similar methods).

Roadmap

🟦 Complete Features:

  • None for now

💡 Unplanned Features:

  • None for now