ptsname() — Get name of the slave pseudoterminal device

Standards

Standards / Extensions C or C++ Dependencies

XPG4.2
Single UNIX Specification, Version 3

both  

Format

#include <stdlib.h>

char *ptsname(int fildes);

General description

The ptsname() function returns the name of the slave pseudoterminal device associated with a master pseudoterminal device. The fildes argument is a file descriptor that refers to the master device. ptsname() returns a pointer to a string containing the path name of the corresponding slave device.

Returned value

If successful, ptsname() returns a pointer to a string which is the name of the pseudoterminal slave device.

If unsuccessful, ptsname() returns a NULL pointer. This could occur if fildes is an invalid file descriptor or if the slave device name does not exist in the file system.

No errors are defined.

Related information