pr_createpipe.rst (1292B)
1 PR_CreatePipe 2 ============= 3 4 Creates an anonymous pipe and retrieves file descriptors for the read 5 and write ends of the pipe. 6 7 8 Syntax 9 ------ 10 11 .. code:: 12 13 #include <prio.h> 14 15 PRStatus PR_CreatePipe( 16 PRFileDesc **readPipe, 17 PRFileDesc **writePipe); 18 19 20 Parameters 21 ~~~~~~~~~~ 22 23 The function has the following parameters: 24 25 ``readPipe`` 26 A pointer to a :ref:`PRFileDesc` pointer. On return, this parameter 27 contains the file descriptor for the read end of the pipe. 28 ``writePipe`` 29 A pointer to a :ref:`PRFileDesc` pointer. On return, this parameter 30 contains the file descriptor for the write end of the pipe. 31 32 33 Returns 34 ~~~~~~~ 35 36 The function returns one of these values: 37 38 - If the pipe is successfully created, ``PR_SUCCESS``. 39 - If the pipe is not successfully created, ``PR_FAILURE``. The error 40 code can be retrieved via :ref:`PR_GetError`. 41 42 43 Description 44 ----------- 45 46 :ref:`PR_CreatePipe` creates an anonymous pipe. Data written into the write 47 end of the pipe can be read from the read end of the pipe. Pipes are 48 useful for interprocess communication between a parent and a child 49 process. When the pipe is no longer needed, both ends should be closed 50 with calls to :ref:`PR_Close`. 51 52 :ref:`PR_CreatePipe` is currently implemented on Unix, Linux, Mac OS X, and 53 Win32 only.