Description


Include file: xpipe.h

Parent class: XIO

Overview

XPipe is a class which provides data-communication between related processes. Therefore you redirect stdin/stdout/stderr to a pipes read- and/or write-handle(s) of the server and client process. The client must be a client-process (see OS/2-docs for details).
To do realy client/server data-communication use DDE (class XDDE) or named pipes (XNamedPipeServer, XNamedPipeClient).

Example:


ULONG hfSave, hfNew = XPIPE_STDERROR;
//save stderror-handle XPipe::DuplicateHandle( XPIPE_STDERROR, hfSave);
//create a pipe and open it XPipe pipe; pipe.Open();
//set the write-handle from the pipe as stderror so the client will write to it XPipe::DuplicateHandle( pipe1.GetWriteHandle(), hfNew);
//start the client-process here XProcess::ExecuteProg(.......);
//close write-handle of the pipe XPipe::CloseHandle( pipe.GetWriteHandle());
//bring the saved handde from stderror back XPipe::DuplicateHandle( hfSave, hfNew);
//close stderror XPipe::CloseHandle(hfSave);
ULONG cbRead; char buffer[XPIPE_DEFAULTSIZE];
do { //read data like a file cbRead = pipe.Read( achBuf, XPIPE_DEFAULTSIZE); } while(cbRead);
//close the pipe pipe.Close();

Functions

DuplicateHandle

Remarks

Dupplicate a handle.

GetReadHandle

Return-Value

ULONG readHandle

Remarks

Returns the read-handle from a pipe

GetWriteHandle

Return-Value

ULONG writeHandle

Remarks

Returns the write-handle from a pipe

Close

Remarks

Close the pipe.

CloseHandle

Parameters

ULONG handle handle to close.

Remarks

Close a single handle.

Open

Parameters

LONG buffersize size of the buffer (default is 4096)

Remarks

Opens a pipe. Afte it is open you can redirect stdin/stdout/stderr to one of its handles.


This document was generated by Jens von Pilgrim's Autodoc