Open a pseudo-terminal device
#include <stdlib.h> #include <fcntl.h> int posix_openpt( int oflag );
- Flags that specify the file status flags and file access modes of the
open file description; a combination of the following:
- O_RDWR — open for reading and writing.
- O_NOCTTY — don't make the terminal device become the controlling terminal for the process.
Use the -l c option to qcc to link against this library. This library is usually included automatically.
The posix_openpt() function establishes a connection between a master device for a pseudo-terminal and a file descriptor. The file descriptor is used by other I/O functions that refer to that pseudo-terminal.
A file descriptor for the master pseudo-terminal, or -1 if an error occurred (errno is set).
- OPEN_MAX file descriptors are currently open in the calling process.
- The maximum allowable number of files is currently open in the system.
- The value of oflag isn't valid.
- Out of pseudo-terminal resources.