pr_getspecialfd.rst (1214B)
1 PR_GetSpecialFD 2 =============== 3 4 Gets the file descriptor that represents the standard input, output, or 5 error stream. 6 7 8 Syntax 9 ------ 10 11 .. code:: 12 13 #include <prio.h> 14 15 PRFileDesc* PR_GetSpecialFD(PRSpecialFD id); 16 17 18 Parameter 19 ~~~~~~~~~ 20 21 The function has the following parameter: 22 23 ``id`` 24 A pointer to an enumerator of type ``PRSpecialFD``, indicating the 25 type of I/O stream desired: ``PR_StandardInput``, 26 ``PR_StandardOutput``, or ``PR_StandardError``. 27 28 29 Returns 30 ~~~~~~~ 31 32 If the ``id`` parameter is valid, :ref:`PR_GetSpecialFD` returns a file 33 descriptor that represents the corresponding standard I/O stream. 34 Otherwise, :ref:`PR_GetSpecialFD` returns ``NULL`` and sets the error to 35 ``PR_INVALID_ARGUMENT_ERROR``. 36 37 38 Description 39 ----------- 40 41 Type ``PRSpecialFD`` is defined as follows: 42 43 .. code:: 44 45 typedef enum PRSpecialFD{ 46 PR_StandardInput, 47 PR_StandardOutput, 48 PR_StandardError 49 } PRSpecialFD; 50 51 ``#define PR_STDIN PR_GetSpecialFD(PR_StandardInput)`` 52 ``#define PR_STDOUT PR_GetSpecialFD(PR_StandardOutput)`` 53 ``#define PR_STDERR PR_GetSpecialFD(PR_StandardError)`` 54 55 File descriptors returned by :ref:`PR_GetSpecialFD` are owned by the 56 runtime and should not be closed by the caller.