Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/t/tcinject.html on line 1
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/t/tcinject.html on line 1
Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/t/tcinject.html on line 8
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/t/tcinject.html on line 8
Inject characters into a device's input buffer
#include <termios.h>
int tcinject( int fd,
char *buf,
int n );
- fildes
- A file descriptor that's associated with the device whose input buffer
you want to add characters to.
- buf
- A pointer to a buffer that contains the characters that you want to
insert.
- n
- The number of characters to insert.
If n is positive, the characters are written
to the canonical (edited) queue.
If n is negative, the characters are written to the raw queue.
libc
Use the -l c option to
qcc
to link against this library.
This library is usually included automatically.
The tcinject() function
injects n characters pointed to by
buf into the input buffer of the device given in
fd.
Note that while injecting into the canonical queue, editing
characters in buf are acted upon as though the user
entered them directly from the device. If buf doesn't
contain a newline (‘\n’), carriage return
(‘\r’) or a data-forwarding character such as
an EOF, data doesn't become available for reading. If
buf does contain a data-forwarding character, it should
contain only one as the last character in buf.
This function is useful for implementing command-line recall
algorithms by injecting recalled lines into the canonical queue.
- 0
- Success.
- -1
- An error occurred
(errno is set).
- EBADF
- The fd argument is invalid
or the file isn't opened for read.
- ENOSYS
- This function isn't supported for the
device opened.
#include <stdio.h>
#include <stdlib.h>
#include <termios.h>
int main( void )
{
char *p = "echo Hello world!\n";
/* Inject the line all at once */
tcinject(0, p, strlen(p));
/* Inject the line one character at a time */
while(*p)
tcinject(0, p++, 1);
return EXIT_SUCCESS;
}
QNX Neutrino
Safety: | |
Cancellation point |
No |
Interrupt handler |
No |
Signal handler |
Yes |
Thread |
Yes |
Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/t/tcinject.html on line 182
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/t/tcinject.html on line 182