.TH "redi::basic_pstreambuf< CharT, Traits >" 3 "Sun Dec 13 2020" "PStreams" \" -*- nroff -*- .ad l .nh .SH NAME redi::basic_pstreambuf \- Class template for stream buffer .SH SYNOPSIS .br .PP .PP \fC#include \fP .PP Inherits basic_streambuf< CharT, std::char_traits< CharT > >, and \fBredi::pstreams\fP\&. .SS "Public Types" .in +1c .ti -1c .RI "typedef CharT \fBchar_type\fP" .br .ti -1c .RI "typedef Traits \fBtraits_type\fP" .br .ti -1c .RI "typedef traits_type::int_type \fBint_type\fP" .br .ti -1c .RI "typedef traits_type::off_type \fBoff_type\fP" .br .ti -1c .RI "typedef traits_type::pos_type \fBpos_type\fP" .br .ti -1c .RI "typedef \fBfd_type\fP \fBfd_t\fP" .br .ti -1c .RI "typedef std::ios_base::openmode \fBpmode\fP" .br .RI "Type used to specify how to connect to the process\&. " .ti -1c .RI "typedef std::vector< std::string > \fBargv_type\fP" .br .RI "Type used to hold the arguments for a command\&. " .ti -1c .RI "typedef int \fBfd_type\fP" .br .RI "Type used for file descriptors\&. " .in -1c .SS "Public Member Functions" .in +1c .ti -1c .RI "\fBbasic_pstreambuf\fP ()" .br .RI "Default constructor\&. " .ti -1c .RI "\fBbasic_pstreambuf\fP (const std::string &cmd, \fBpmode\fP mode)" .br .RI "Constructor that initialises the buffer with \fIcmd\fP\&. " .ti -1c .RI "\fBbasic_pstreambuf\fP (const std::string &file, const \fBargv_type\fP &argv, \fBpmode\fP mode)" .br .RI "Constructor that initialises the buffer with \fIfile\fP and \fIargv\fP\&. " .ti -1c .RI "\fB~basic_pstreambuf\fP ()" .br .RI "Destructor\&. " .ti -1c .RI "\fBbasic_pstreambuf\fP * \fBopen\fP (const std::string &cmd, \fBpmode\fP mode)" .br .RI "Initialise the stream buffer with \fIcmd\fP\&. " .ti -1c .RI "\fBbasic_pstreambuf\fP * \fBopen\fP (const std::string &file, const \fBargv_type\fP &argv, \fBpmode\fP mode)" .br .RI "Initialise the stream buffer with \fIfile\fP and \fIargv\fP\&. " .ti -1c .RI "\fBbasic_pstreambuf\fP * \fBclose\fP ()" .br .RI "Close the stream buffer and wait for the process to exit\&. " .ti -1c .RI "\fBbasic_pstreambuf\fP * \fBkill\fP (int signal=SIGTERM)" .br .RI "Send a signal to the process\&. " .ti -1c .RI "\fBbasic_pstreambuf\fP * \fBkillpg\fP (int signal=SIGTERM)" .br .RI "Send a signal to the process' process group\&. " .ti -1c .RI "void \fBpeof\fP ()" .br .RI "Close the pipe connected to the process' stdin\&. " .ti -1c .RI "bool \fBread_err\fP (bool readerr=true)" .br .RI "Change active input source\&. " .ti -1c .RI "bool \fBis_open\fP () const" .br .RI "Report whether the stream buffer has been initialised\&. " .ti -1c .RI "bool \fBexited\fP ()" .br .RI "Report whether the process has exited\&. " .ti -1c .RI "int \fBstatus\fP () const" .br .RI "Return the exit status of the process\&. " .ti -1c .RI "int \fBerror\fP () const" .br .RI "Return the error number (errno) for the most recent failed operation\&. " .in -1c .SS "Static Public Attributes" .in +1c .ti -1c .RI "static const \fBpmode\fP \fBpstdin\fP = std::ios_base::out" .br .RI "Write to stdin\&. " .ti -1c .RI "static const \fBpmode\fP \fBpstdout\fP = std::ios_base::in" .br .RI "Read from stdout\&. " .ti -1c .RI "static const \fBpmode\fP \fBpstderr\fP = std::ios_base::app" .br .RI "Read from stderr\&. " .ti -1c .RI "static const \fBpmode\fP \fBnewpg\fP = std::ios_base::trunc" .br .RI "Create a new process group for the child process\&. " .in -1c .SS "Protected Types" .in +1c .ti -1c .RI "enum \fBbuf_read_src\fP { \fBrsrc_out\fP = 0, \fBrsrc_err\fP = 1 }" .br .RI "Enumerated type to indicate whether stdout or stderr is to be read\&. " .ti -1c .RI "enum { \fBbufsz\fP = 32 }" .br .ti -1c .RI "enum { \fBpbsz\fP = 2 }" .br .in -1c .SS "Protected Member Functions" .in +1c .ti -1c .RI "int_type \fBoverflow\fP (int_type c)" .br .RI "Transfer characters to the pipe when character buffer overflows\&. " .ti -1c .RI "int_type \fBunderflow\fP ()" .br .RI "Transfer characters from the pipe when the character buffer is empty\&. " .ti -1c .RI "int_type \fBpbackfail\fP (int_type c=traits_type::eof())" .br .RI "Make a character available to be returned by the next extraction\&. " .ti -1c .RI "int \fBsync\fP ()" .br .RI "Write any buffered characters to the stream\&. " .ti -1c .RI "std::streamsize \fBxsputn\fP (const char_type *s, std::streamsize n)" .br .RI "Insert multiple characters into the pipe\&. " .ti -1c .RI "std::streamsize \fBwrite\fP (const char_type *s, std::streamsize n)" .br .RI "Insert a sequence of characters into the pipe\&. " .ti -1c .RI "std::streamsize \fBread\fP (char_type *s, std::streamsize n)" .br .RI "Extract a sequence of characters from the pipe\&. " .ti -1c .RI "std::streamsize \fBshowmanyc\fP ()" .br .RI "Report how many characters can be read from active input without blocking\&. " .ti -1c .RI "pid_t \fBfork\fP (\fBpmode\fP mode)" .br .RI "Initialise pipes and fork process\&. " .ti -1c .RI "int \fBwait\fP (bool nohang=false)" .br .RI "Wait for the child process to exit\&. " .ti -1c .RI "\fBfd_type\fP & \fBwpipe\fP ()" .br .RI "Return the file descriptor for the output pipe\&. " .ti -1c .RI "\fBfd_type\fP & \fBrpipe\fP ()" .br .RI "Return the file descriptor for the active input pipe\&. " .ti -1c .RI "\fBfd_type\fP & \fBrpipe\fP (\fBbuf_read_src\fP which)" .br .RI "Return the file descriptor for the specified input pipe\&. " .ti -1c .RI "void \fBcreate_buffers\fP (\fBpmode\fP mode)" .br .ti -1c .RI "void \fBdestroy_buffers\fP (\fBpmode\fP mode)" .br .ti -1c .RI "bool \fBempty_buffer\fP ()" .br .RI "Writes buffered characters to the process' stdin pipe\&. " .ti -1c .RI "bool \fBfill_buffer\fP (bool non_blocking=false)" .br .ti -1c .RI "char_type * \fBrbuffer\fP ()" .br .RI "Return the active input buffer\&. " .ti -1c .RI "\fBbuf_read_src\fP \fBswitch_read_buffer\fP (\fBbuf_read_src\fP)" .br .in -1c .SS "Related Functions" (Note that these are not member functions\&.) .in +1c .ti -1c .RI "void \fBclose_fd\fP (\fBpstreams::fd_type\fP &fd)" .br .RI "Helper function to close a file descriptor\&. " .ti -1c .RI "template void \fBclose_fd_array\fP (\fBpstreams::fd_type\fP(&fds)[N])" .br .RI "Helper function to close an array of file descriptors\&. " .in -1c .SH "Detailed Description" .PP .SS "template> .br class redi::basic_pstreambuf< CharT, Traits >" Class template for stream buffer\&. Provides underlying streambuf functionality for the PStreams classes\&. .SH "Member Typedef Documentation" .PP .SS "template> typedef \fBfd_type\fP \fBredi::basic_pstreambuf\fP< CharT, Traits >::\fBfd_t\fP" .PP \fBDeprecated\fP .RS 4 use \fBpstreams::fd_type\fP instead\&. .RE .PP .SH "Constructor & Destructor Documentation" .PP .SS "template \fBredi::basic_pstreambuf\fP< C, T >::\fBbasic_pstreambuf\fP\fC [inline]\fP" .PP Default constructor\&. Creates an uninitialised stream buffer\&. .SS "template \fBredi::basic_pstreambuf\fP< C, T >::\fBbasic_pstreambuf\fP (const std::string & cmd, \fBpmode\fP mode)\fC [inline]\fP" .PP Constructor that initialises the buffer with \fIcmd\fP\&. Initialises the stream buffer by calling \fBopen()\fP with the supplied arguments\&. .PP \fBParameters\fP .RS 4 \fIcmd\fP a string containing a shell command\&. .br \fImode\fP the I/O mode to use when opening the pipe\&. .RE .PP \fBSee also\fP .RS 4 \fBopen()\fP .RE .PP .PP References redi::basic_pstreambuf< CharT, Traits >::open()\&. .SS "template \fBredi::basic_pstreambuf\fP< C, T >::\fBbasic_pstreambuf\fP (const std::string & file, const \fBargv_type\fP & argv, \fBpmode\fP mode)\fC [inline]\fP" .PP Constructor that initialises the buffer with \fIfile\fP and \fIargv\fP\&. Initialises the stream buffer by calling \fBopen()\fP with the supplied arguments\&. .PP \fBParameters\fP .RS 4 \fIfile\fP a string containing the name of a program to execute\&. .br \fIargv\fP a vector of argument strings passsed to the new program\&. .br \fImode\fP the I/O mode to use when opening the pipe\&. .RE .PP \fBSee also\fP .RS 4 \fBopen()\fP .RE .PP .PP References redi::basic_pstreambuf< CharT, Traits >::open()\&. .SS "template \fBredi::basic_pstreambuf\fP< C, T >::~\fBbasic_pstreambuf\fP\fC [inline]\fP" .PP Destructor\&. Closes the stream by calling \fBclose()\fP\&. .PP \fBSee also\fP .RS 4 \fBclose()\fP .RE .PP .SH "Member Function Documentation" .PP .SS "template \fBbasic_pstreambuf\fP< C, T > * \fBredi::basic_pstreambuf\fP< C, T >::close" .PP Close the stream buffer and wait for the process to exit\&. Closes all pipes and calls \fBwait()\fP to wait for the process to finish\&. If an error occurs the error code will be set to one of the possible errors for \fCwaitpid()\fP\&. See your system's documentation for these errors\&. .PP \fBReturns\fP .RS 4 \fCthis\fP on successful close or \fCNULL\fP if there is no process to close or if an error occurs\&. .RE .PP .SS "template bool \fBredi::basic_pstreambuf\fP< C, T >::empty_buffer\fC [protected]\fP" .PP Writes buffered characters to the process' stdin pipe\&. .PP \fBReturns\fP .RS 4 true if the buffer was emptied, false otherwise\&. .RE .PP .SS "template int \fBredi::basic_pstreambuf\fP< C, T >::error\fC [inline]\fP" .PP Return the error number (errno) for the most recent failed operation\&. .PP \fBReturns\fP .RS 4 The error code of the most recently failed operation, or zero\&. .RE .PP .SS "template bool \fBredi::basic_pstreambuf\fP< C, T >::exited\fC [inline]\fP" .PP Report whether the process has exited\&. This function can call \fBpstreambuf::wait()\fP and so may change the object's state if the child process has already exited\&. .PP \fBReturns\fP .RS 4 True if the associated process has exited, false otherwise\&. .RE .PP \fBSee also\fP .RS 4 \fBbasic_pstreambuf::wait()\fP .RE .PP .SS "template bool \fBredi::basic_pstreambuf\fP< C, T >::fill_buffer (bool non_blocking = \fCfalse\fP)\fC [protected]\fP" .PP \fBReturns\fP .RS 4 true if the buffer was filled, false otherwise\&. .RE .PP .SS "template pid_t \fBredi::basic_pstreambuf\fP< C, T >::fork (\fBpmode\fP mode)\fC [protected]\fP" .PP Initialise pipes and fork process\&. Creates pipes as specified by \fImode\fP and calls \fC\fBfork()\fP\fP to create a new process\&. If the fork is successful the parent process stores the child's PID and the opened pipes and the child process replaces its standard streams with the opened pipes\&. .PP If an error occurs the error code will be set to one of the possible errors for \fCpipe()\fP or \fC\fBfork()\fP\fP\&. See your system's documentation for these error codes\&. .PP \fBParameters\fP .RS 4 \fImode\fP an OR of pmodes specifying which of the child's standard streams to connect to\&. .RE .PP \fBReturns\fP .RS 4 On success the PID of the child is returned in the parent's context and zero is returned in the child's context\&. On error -1 is returned and the error code is set appropriately\&. .RE .PP .SS "template bool \fBredi::basic_pstreambuf\fP< C, T >::is_open\fC [inline]\fP" .PP Report whether the stream buffer has been initialised\&. Unlike \fBpstreambuf::exited()\fP, this function will not call \fBwait()\fP and so will not change the object's state\&. This means that once a child process is executed successfully this function will continue to return true even after the process exits (until \fBwait()\fP is called\&.) .PP \fBReturns\fP .RS 4 true if a previous call to \fBopen()\fP succeeded and \fBwait()\fP has not been called and determined that the process has exited, false otherwise\&. .RE .PP .SS "template \fBbasic_pstreambuf\fP< C, T > * \fBredi::basic_pstreambuf\fP< C, T >::kill (int signal = \fCSIGTERM\fP)\fC [inline]\fP" .PP Send a signal to the process\&. Sends the specified signal to the process\&. A signal can be used to terminate a child process that would not exit otherwise\&. .PP If an error occurs the error code will be set to one of the possible errors for \fC\fBkill()\fP\fP\&. See your system's documentation for these errors\&. .PP \fBParameters\fP .RS 4 \fIsignal\fP A signal to send to the child process\&. .RE .PP \fBReturns\fP .RS 4 \fCthis\fP or \fCNULL\fP if \fC\fBkill()\fP\fP fails\&. .RE .PP .SS "template \fBbasic_pstreambuf\fP< C, T > * \fBredi::basic_pstreambuf\fP< C, T >::killpg (int signal = \fCSIGTERM\fP)\fC [inline]\fP" .PP Send a signal to the process' process group\&. Sends the specified signal to the process group of the child process\&. A signal can be used to terminate a child process that would not exit otherwise, or to kill the process and its own children\&. .PP If an error occurs the error code will be set to one of the possible errors for \fCgetpgid()\fP or \fC\fBkill()\fP\fP\&. See your system's documentation for these errors\&. If the child is in the current process group then NULL will be returned and the error code set to EPERM\&. .PP \fBParameters\fP .RS 4 \fIsignal\fP A signal to send to the child process\&. .RE .PP \fBReturns\fP .RS 4 \fCthis\fP on success or \fCNULL\fP on failure\&. .RE .PP .SS "template \fBbasic_pstreambuf\fP< C, T > * \fBredi::basic_pstreambuf\fP< C, T >::open (const std::string & command, \fBpmode\fP mode)" .PP Initialise the stream buffer with \fIcmd\fP\&. Starts a new process by passing \fIcommand\fP to the shell (/bin/sh) and opens pipes to the process with the specified \fImode\fP\&. .PP If \fImode\fP contains \fCpstdout\fP the initial read source will be the child process' stdout, otherwise if \fImode\fP contains \fCpstderr\fP the initial read source will be the child's stderr\&. .PP Will duplicate the actions of the shell in searching for an executable file if the specified file name does not contain a slash (/) character\&. .PP \fBWarning\fP .RS 4 There is no way to tell whether the shell command succeeded, this function will always succeed unless resource limits (such as memory usage, or number of processes or open files) are exceeded\&. This means \fBis_open()\fP will return true even if \fIcommand\fP cannot be executed\&. Use \fBpstreambuf::open(const std::string&, const argv_type&, pmode)\fP if you need to know whether the command failed to execute\&. .RE .PP \fBParameters\fP .RS 4 \fIcommand\fP a string containing a shell command\&. .br \fImode\fP a bitwise OR of one or more of \fCout\fP, \fCin\fP, \fCerr\fP\&. .RE .PP \fBReturns\fP .RS 4 NULL if the shell could not be started or the pipes could not be opened, \fCthis\fP otherwise\&. .RE .PP \fBSee also\fP .RS 4 \fBexecl\fP(3) .RE .PP .PP Referenced by redi::basic_pstreambuf< CharT, Traits >::basic_pstreambuf()\&. .SS "template \fBbasic_pstreambuf\fP< C, T > * \fBredi::basic_pstreambuf\fP< C, T >::open (const std::string & file, const \fBargv_type\fP & argv, \fBpmode\fP mode)" .PP Initialise the stream buffer with \fIfile\fP and \fIargv\fP\&. Starts a new process by executing \fIfile\fP with the arguments in \fIargv\fP and opens pipes to the process with the specified \fImode\fP\&. .PP By convention \fCargv\fP[0] should be the file name of the file being executed\&. .PP If \fImode\fP contains \fCpstdout\fP the initial read source will be the child process' stdout, otherwise if \fImode\fP contains \fCpstderr\fP the initial read source will be the child's stderr\&. .PP Will duplicate the actions of the shell in searching for an executable file if the specified file name does not contain a slash (/) character\&. .PP Iff \fIfile\fP is successfully executed then \fBis_open()\fP will return true\&. Otherwise, \fBpstreambuf::error()\fP can be used to obtain the value of \fCerrno\fP that was set by \fBexecvp\fP(3) in the child process\&. .PP The exit status of the new process will be returned by \fBpstreambuf::status()\fP after \fBpstreambuf::exited()\fP returns true\&. .PP \fBParameters\fP .RS 4 \fIfile\fP a string containing the pathname of a program to execute\&. .br \fIargv\fP a vector of argument strings passed to the new program\&. .br \fImode\fP a bitwise OR of one or more of \fCout\fP, \fCin\fP and \fCerr\fP\&. .RE .PP \fBReturns\fP .RS 4 NULL if a pipe could not be opened or if the program could not be executed, \fCthis\fP otherwise\&. .RE .PP \fBSee also\fP .RS 4 \fBexecvp\fP(3) .RE .PP .SS "template \fBbasic_pstreambuf\fP< C, T >::int_type \fBredi::basic_pstreambuf\fP< C, T >::overflow (int_type c)\fC [protected]\fP" .PP Transfer characters to the pipe when character buffer overflows\&. Called when the internal character buffer is not present or is full, to transfer the buffer contents to the pipe\&. .PP \fBParameters\fP .RS 4 \fIc\fP a character to be written to the pipe\&. .RE .PP \fBReturns\fP .RS 4 \fCtraits_type::eof()\fP if an error occurs, otherwise if \fIc\fP is not equal to \fCtraits_type::eof()\fP it will be buffered and a value other than \fCtraits_type::eof()\fP returned to indicate success\&. .RE .PP .SS "template \fBbasic_pstreambuf\fP< C, T >::int_type \fBredi::basic_pstreambuf\fP< C, T >::pbackfail (int_type c = \fCtraits_type::eof()\fP)\fC [protected]\fP" .PP Make a character available to be returned by the next extraction\&. Attempts to make \fIc\fP available as the next character to be read by \fCsgetc()\fP\&. .PP \fBParameters\fP .RS 4 \fIc\fP a character to make available for extraction\&. .RE .PP \fBReturns\fP .RS 4 \fIc\fP if the character can be made available, \fCtraits_type::eof()\fP otherwise\&. .RE .PP .SS "template void \fBredi::basic_pstreambuf\fP< C, T >::peof\fC [inline]\fP" .PP Close the pipe connected to the process' stdin\&. Closes the output pipe, causing the child process to receive the end-of-file indicator on subsequent reads from its \fCstdin\fP stream\&. .PP Referenced by redi::basic_opstream< CharT, Traits >::peof()\&. .SS "template \fBbasic_pstreambuf\fP< C, T >::char_type * \fBredi::basic_pstreambuf\fP< C, T >::rbuffer\fC [inline]\fP, \fC [protected]\fP" .PP Return the active input buffer\&. .PP \fBReturns\fP .RS 4 a pointer to the start of the active input buffer area\&. .RE .PP .SS "template std::streamsize \fBredi::basic_pstreambuf\fP< C, T >::read (char_type * s, std::streamsize n)\fC [inline]\fP, \fC [protected]\fP" .PP Extract a sequence of characters from the pipe\&. Reads up to \fIn\fP characters from the pipe to the buffer \fIs\fP\&. .PP \fBParameters\fP .RS 4 \fIs\fP character buffer\&. .br \fIn\fP buffer length\&. .RE .PP \fBReturns\fP .RS 4 the number of characters read\&. .RE .PP .SS "template bool \fBredi::basic_pstreambuf\fP< C, T >::read_err (bool readerr = \fCtrue\fP)\fC [inline]\fP" .PP Change active input source\&. Toggle the stream used for reading\&. If \fIreaderr\fP is \fCtrue\fP then the process' \fCstderr\fP output will be used for subsequent extractions, if \fIreaderr\fP is false the the process' stdout will be used\&. .PP \fBParameters\fP .RS 4 \fIreaderr\fP \fCtrue\fP to read \fCstderr\fP, \fCfalse\fP to read \fCstdout\fP\&. .RE .PP \fBReturns\fP .RS 4 \fCtrue\fP if the requested stream is open and will be used for subsequent extractions, \fCfalse\fP otherwise\&. .RE .PP .PP Referenced by redi::basic_ipstream< CharT, Traits >::err(), redi::basic_pstream< CharT, Traits >::err(), redi::basic_rpstream< CharT, Traits >::err(), redi::basic_ipstream< CharT, Traits >::out(), redi::basic_pstream< CharT, Traits >::out(), and redi::basic_rpstream< CharT, Traits >::out()\&. .SS "template \fBpstreams::fd_type\fP & \fBredi::basic_pstreambuf\fP< C, T >::rpipe\fC [inline]\fP, \fC [protected]\fP" .PP Return the file descriptor for the active input pipe\&. .PP \fBReturns\fP .RS 4 a reference to the active input file descriptor .RE .PP .SS "template \fBpstreams::fd_type\fP & \fBredi::basic_pstreambuf\fP< C, T >::rpipe (\fBbuf_read_src\fP which)\fC [inline]\fP, \fC [protected]\fP" .PP Return the file descriptor for the specified input pipe\&. .PP \fBReturns\fP .RS 4 a reference to the specified input file descriptor .RE .PP .SS "template int \fBredi::basic_pstreambuf\fP< C, T >::status\fC [inline]\fP" .PP Return the exit status of the process\&. .PP \fBReturns\fP .RS 4 The exit status of the child process, or -1 if \fBwait()\fP has not yet been called to wait for the child to exit\&. .RE .PP \fBSee also\fP .RS 4 \fBbasic_pstreambuf::wait()\fP .RE .PP .SS "template \fBbasic_pstreambuf\fP< C, T >::int_type \fBredi::basic_pstreambuf\fP< C, T >::underflow\fC [protected]\fP" .PP Transfer characters from the pipe when the character buffer is empty\&. Called when the internal character buffer is is empty, to re-fill it from the pipe\&. .PP \fBReturns\fP .RS 4 The first available character in the buffer, or \fCtraits_type::eof()\fP in case of failure\&. .RE .PP .SS "template int \fBredi::basic_pstreambuf\fP< C, T >::wait (bool nohang = \fCfalse\fP)\fC [protected]\fP" .PP Wait for the child process to exit\&. Suspends execution and waits for the associated process to exit, or until a signal is delivered whose action is to terminate the current process or to call a signal handling function\&. If the process has already exited (i\&.e\&. it is a 'zombie' process) then \fBwait()\fP returns immediately\&. Waiting for the child process causes all its system resources to be freed\&. .PP \fBerror()\fP will return EINTR if \fBwait()\fP is interrupted by a signal\&. .PP \fBParameters\fP .RS 4 \fInohang\fP true to return immediately if the process has not exited\&. .RE .PP \fBReturns\fP .RS 4 1 if the process has exited and \fBwait()\fP has not yet been called\&. 0 if \fInohang\fP is true and the process has not exited yet\&. -1 if no process has been started or if an error occurs, in which case the error can be found using \fBerror()\fP\&. .RE .PP .SS "template \fBpstreams::fd_type\fP & \fBredi::basic_pstreambuf\fP< C, T >::wpipe\fC [inline]\fP, \fC [protected]\fP" .PP Return the file descriptor for the output pipe\&. .PP \fBReturns\fP .RS 4 a reference to the output file descriptor .RE .PP .SS "template std::streamsize \fBredi::basic_pstreambuf\fP< C, T >::write (const char_type * s, std::streamsize n)\fC [inline]\fP, \fC [protected]\fP" .PP Insert a sequence of characters into the pipe\&. Writes up to \fIn\fP characters to the pipe from the buffer \fIs\fP\&. .PP \fBParameters\fP .RS 4 \fIs\fP character buffer\&. .br \fIn\fP buffer length\&. .RE .PP \fBReturns\fP .RS 4 the number of characters written\&. .RE .PP .SS "template std::streamsize \fBredi::basic_pstreambuf\fP< C, T >::xsputn (const char_type * s, std::streamsize n)\fC [protected]\fP" .PP Insert multiple characters into the pipe\&. .PP \fBParameters\fP .RS 4 \fIs\fP character buffer\&. .br \fIn\fP buffer length\&. .RE .PP \fBReturns\fP .RS 4 the number of characters written\&. .RE .PP .SH "Friends And Related Function Documentation" .PP .SS "template> void close_fd (\fBpstreams::fd_type\fP & fd)\fC [related]\fP" .PP Helper function to close a file descriptor\&. Inspects \fIfd\fP and calls \fBclose\fP(3) if it has a non-negative value\&. .PP \fBParameters\fP .RS 4 \fIfd\fP a file descriptor\&. .RE .PP .SS "template void close_fd_array (\fBpstreams::fd_type\fP(&) fds[N])\fC [related]\fP" .PP Helper function to close an array of file descriptors\&. Calls \fC\fBclose_fd()\fP\fP on each member of the array\&. The length of the array is determined automatically by template argument deduction to avoid errors\&. .PP \fBParameters\fP .RS 4 \fIfds\fP an array of file descriptors\&. .RE .PP .SH "Author" .PP Generated automatically by Doxygen for PStreams from the source code\&.