GClasses
|
This class wraps the handle of a pipe. It closes the pipe when it is destroyed. This class is useful in conjunction with GApp::systemExecute for reading from, or writing to, the standard i/o streams of a child process.
#include <GApp.h>
Public Member Functions | |
GPipe () | |
Construct an empty pipe holder. More... | |
~GPipe () | |
HANDLE | get () |
Returns the current handle. More... | |
ssize_t | read (char *buf, size_t bufSize) |
Read from the pipe until there is nothing else to read, or the buffer is full. More... | |
std::string | read (size_t maxSize=(size_t)-1) |
Read from the pipe until there is nothing else to read. More... | |
void | set (HANDLE h) |
Set the handle of the pipe. More... | |
void | toFile (const char *szFilename) |
Reads from the pipe and writes to the specified file, until there is nothing left to read. More... | |
void | write (const char *buf, size_t bufSize) |
Write to the pipe. More... | |
Protected Attributes | |
HANDLE | m_handle |
GClasses::GPipe::GPipe | ( | ) |
Construct an empty pipe holder.
GClasses::GPipe::~GPipe | ( | ) |
|
inline |
Returns the current handle.
ssize_t GClasses::GPipe::read | ( | char * | buf, |
size_t | bufSize | ||
) |
Read from the pipe until there is nothing else to read, or the buffer is full.
std::string GClasses::GPipe::read | ( | size_t | maxSize = (size_t)-1 | ) |
Read from the pipe until there is nothing else to read.
void GClasses::GPipe::set | ( | HANDLE | h | ) |
Set the handle of the pipe.
void GClasses::GPipe::toFile | ( | const char * | szFilename | ) |
Reads from the pipe and writes to the specified file, until there is nothing left to read.
void GClasses::GPipe::write | ( | const char * | buf, |
size_t | bufSize | ||
) |
Write to the pipe.
|
protected |