#include <termios.h> int w_ioctl(int fileDescriptor, int command, int argLength, void *argBuffer);
w_ioctl
enables you to pass device-specific commands and
arguments to an I/O device driver. w_ioctl
accepts the
following arguments:
fileDescriptor
command
argLength
arg
argument. The
minimum length is 1 and maximum length is 1024.
argBuffer
w_ioctl
returns a 0
if successful and a -1
if unsuccessful.
w_ioctl
function may be useful in OpenEdition
applications; however,
it is not defined by the POSIX.1 standard and should not be used
in portable applications.
w_ioctl
to
pass a command to the controlling terminal:
#include <sys/types.h> #include <stdio.h> #include <unistd.h> #define MAX_BUFFER 1024 #define BREAK 0x00 #define DEV_SPECIFIC_CMD 1 main() { char parameters[MAX_BUFFER]; int result; /* Initialize parameter buffer. */ memset(parameters, BREAK, sizeof(parameters)); /* Pass command and parameter to stdin device driver. */ if ((result = w_ioctl(STDIN_FILENO, DEV_SPECIFIC_CMD, sizeof(parameters), parameters)) != 0) perror("I/O control error"); else printf("SUCCESSn"); }
tcdrain
, tcflow
, tcflush
, tcsendbreak