![]() |
![]() |
![]() |
Write a string to a device
#include <sys/modem.h> int modem_write( int fd, char* str );
libc
The modem_write() function writes the string str to the device specified by the file descriptor fd. Just before writing each character, all buffered input from the same device is flushed. After writing each character an attempt to read an echo is made. The intent is to write a string without it appearing back in the input stream even if the device is echoing each character written.
If the \ character appears in str then the character following it is interpreted by modem_write() and instead of both being output they are treated as a special escape sequence which causes the following actions to be taken:
Escape | Description |
---|---|
\r | Output a carriage return. |
\n | Output a newline. |
\xhh | Output the single character whose hex representation follows as hh. |
\B | Send a 500 msec break on the line using tcsendbreak(). |
\D | Drop the line for 1 second using tcdropline(). |
\Phh | Pause for hh 1/10 of a second where hh is two hex characters. |
Zero on success, -1 on failure (errno is set ).
Safety: | |
---|---|
Cancellation point | Yes |
Interrupt handler | No |
Signal handler | Yes |
Thread | Yes |
modem_open(), modem_read(), modem_script()
![]() |
![]() |
![]() |