w_ioctl -- Pass Command and Arguments to an I/O Device

SYNOPSIS

 #include <termios.h>

 int w_ioctl(int fileDescriptor, int command, int argLength,
             void *argBuffer);
 

DESCRIPTION

w_ioctl enables you to pass device-specific commands and arguments to an I/O device driver. w_ioctl accepts the following arguments:
fileDescriptor
is a file descriptor for a file associated with a device driver.
command
is an integer that specifies a device-specific command that is passed to the device driver.
argLength
specifies the length in bytes of the arg argument. The minimum length is 1 and maximum length is 1024.
argBuffer
is a pointer to the buffer that holds the arguments to be passed to the device driver.

RETURN VALUE

w_ioctl returns a 0 if successful and a -1 if unsuccessful.

PORTABILITY

The 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.

EXAMPLE

The following example illustrates the use of 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");
  }

 

RELATED FUNCTIONS

tcdrain, tcflow, tcflush, tcsendbreak


Copyright (c) 1998 SAS Institute Inc. Cary, NC, USA. All rights reserved.