Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

ptsname - name of pseudoterminal

&pagelevel(4)&pagelevel

Syntax

#include <stdlib.h>

char *ptsname(int fildes);

Description  The ptsname() function returns the name of the slave pseudoterminal that is assigned to

the master pseudoterminal. fildes is the file descriptor that references the master terminal.
ptsname() returns a pointer to a string containing the pathname of the corresponding slave
terminal. The name is terminated with the null byte.

The name has the format /dev/pts/N, where N is an integer between 0 and 255.

ptsname() is not thread-safe.

Return val.

Pointer to a string

if successful. The string contains the name of the slave terminal.

Null pointer

if an error occurs. This can happen if fildes is not a valid file descriptor or if
the name of the slave terminal does not exist in the file system.

Notes

See also

The pointer points to a static data area that is overwritten every time ptsname() is called.

grantpt(), ttyname(), unlockpt(), stdlib.h.