This is the mail archive of the cygwin@sources.redhat.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: How to create tty/pty pair ?


On Sat, Dec 30, 2000 at 11:19:17PM +0200, Ehud Karni wrote:
>I do not know how to make a tty/pty pair with Cygwin.

/dev/ptmx is the mechanism.  Here is some sample code:

    char *slave;
    int om = open ("/dev/ptmx", O_RDWR);
    if (om < 0)
      die ("/dev/ptmx", 1);

    if (grantpt (om) < 0)
      die ("grantpt", 2);

    if (unlockpt (om) < 0)
      die ("unlockpt", 3);

    slave = ptsname (om);
    if (slave == NULL)
      die ("ptsname", 4);

cgf

--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]