insert characters in the canonical input buffer of a device
#include <sys/dev.h> int dev_insert_chars( int fd, int n, char *buf );
The dev_insert_chars() function inserts the n characters pointed to by buf into the canonical input buffer of the opened device given in fd. If n is negative, the characters are written into the raw queue rather than the canonical queue.
The dev_insert_chars() function is useful for implementing command-line recall algorithms.
#include <sys/dev.h>
#include <string.h>
int main( void )
{
unsigned char *p;
/* Insert the following characters into the standard
input, as if they had been typed on the keyboard
(Note: the \r instead of \n) */
p = "Hello World!!!\r";
dev_insert_chars( 0, strlen( p ), p );
return( EXIT_SUCCESS );
}
QNX
| Safety: | |
|---|---|
| Interrupt handler | No |
| Signal handler | Yes, but modifies errno |
| Thread | Yes |