#include #include #include #include int main(int argc, char **argv) { int ptyfd = open("/dev/ptmx", O_RDWR); if (ptyfd < 0) { printf("could not open /dev/ptmx: %d %s\n", errno, strerror(errno)); } else if (grantpt(ptyfd) <0) { printf("could not grantpt: %d %s\n", errno, strerror(errno)); } else { printf("success\n"); } }