Disconnect a communications line
#include <termios.h> int tcdropline( int fd, int duration );
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
The tcdropline() function initiates a disconnect condition on the communication line associated with the opened file descriptor indicated by fd.
The disconnect condition lasts at least duration milliseconds, or approximately 300 milliseconds if duration is zero. The system rounds the effective value of duration up to the next highest supported interval, which is typically a multiple of 100 milliseconds.
#include <termios.h> #include <fcntl.h> #include <unistd.h> #include <stdlib.h> int main( void ) { int fd; fd = open( "/dev/ser1", O_RDWR ); /* Disconnect for 500 milliseconds */ tcdropline( fd, 500 ); close( fd ); return EXIT_SUCCESS; }
Safety: | |
---|---|
Cancellation point | No |
Interrupt handler | No |
Signal handler | Yes |
Thread | Yes |
tcdrain(), tcflow(), tcflush()