#include "types.hh"
#include "error.hh"
Go to the source code of this file.
|
std::string | nix::readFile (Descriptor fd) |
|
void | nix::readFull (Descriptor fd, char *buf, size_t count) |
|
void | nix::writeFull (Descriptor fd, std::string_view s, bool allowInterrupts=true) |
|
std::string | nix::readLine (Descriptor fd, bool eofOk=false) |
|
void | nix::writeLine (Descriptor fd, std::string s) |
|
std::string | nix::drainFD (Descriptor fd, bool block, const size_t reserveSize) |
|
void | nix::drainFD (Descriptor fd, Sink &sink, bool block=true) |
|
Descriptor | nix::getStandardInput () |
|
Descriptor | nix::getStandardOutput () |
|
Descriptor | nix::getStandardError () |
|
void | nix::unix::closeExtraFDs () |
|
void | nix::unix::closeOnExec (Descriptor fd) |
|
| nix::MakeError (EndOfFile, Error) |
|
◆ Descriptor
Initial value:Operating System capability
◆ closeExtraFDs()
void nix::unix::closeExtraFDs |
( |
| ) |
|
Close all file descriptors except stdio fds (ie 0, 1, 2). Good practice in child processes.
◆ closeOnExec()
Set the close-on-exec flag for the given file descriptor.
◆ drainFD() [1/2]
std::string nix::drainFD |
( |
Descriptor | fd, |
|
|
bool | block = true, |
|
|
const size_t | reserveSize = 0 ) |
Read a file descriptor until EOF occurs.
◆ drainFD() [2/2]
The Windows version is always blocking.
◆ getStandardError()
Descriptor nix::getStandardError |
( |
| ) |
|
|
inline |
◆ getStandardInput()
Descriptor nix::getStandardInput |
( |
| ) |
|
|
inline |
◆ getStandardOutput()
Descriptor nix::getStandardOutput |
( |
| ) |
|
|
inline |
◆ readFile()
Read the contents of a resource into a string.
◆ readFull()
Wrappers arount read()/write() that read/write exactly the requested number of bytes.
◆ readLine()
std::string nix::readLine |
( |
Descriptor | fd, |
|
|
bool | eofOk = false ) |
Read a line from a file descriptor.
- Parameters
-
fd | The file descriptor to read from |
eofOk | If true, return an unterminated line if EOF is reached. (e.g. the empty string) |
- Returns
- A line of text ending in
\n
, or a string without \n
if eofOk
is true and EOF is reached.
◆ writeLine()
void nix::writeLine |
( |
Descriptor | fd, |
|
|
std::string | s ) |
Write a line to a file descriptor.
◆ INVALID_DESCRIPTOR
const Descriptor nix::INVALID_DESCRIPTOR |