Путеводитель по Руководству Linux

  User  |  Syst  |  Libr  |  Device  |  Files  |  Other  |  Admin  |  Head  |



   tty_ioctl    ( 4 )

ioctls для терминалов и последовательных линий (ioctls for terminals and serial lines)

  Name  |  Synopsis  |  Description  |  Return value  |  Error  |    Examples    |  See also  |

Примеры (Examples)

Check the condition of DTR on the serial port.

#include <stdio.h> #include <unistd.h> #include <fcntl.h> #include <sys/ioctl.h>

int main(void) { int fd, serial;

fd = open("/dev/ttyS0", O_RDONLY); ioctl(fd, TIOCMGET, &serial); if (serial & TIOCM_DTR) puts("TIOCM_DTR is set"); else puts("TIOCM_DTR is not set"); close(fd); }