%ioctl() function

The %ioctl() function is a general purpose control function that passes the arguments request and arg to the device designated by file.descriptor.

For Windows: Not Supported

Syntax

var = %ioctl(file.descriptor, request, arg)

Description

The format of the arguments is device-specific. These arguments are usually binary data that must be kept out of FlashBASIC data space. See the example below.

CAUTION:
Extreme care must be exercised when using this function. The arguments to %ioctl() are dependent on the system and the UNIX version. Whenever possible, it is preferable to use the D3 tools to access a device. For example, execute set-baud /dev/tty15,9600 works on all Pick implementations, while the corresponding UNIX ioctl() function varies widely.

Example(s)

* Allocate some data
ptr=(char*)%malloc(128)
* Open the terminal and get its termio structure
execute "!exec tty" capturing ttyname
fd=%open(ttyname, o$rdwr)
n=%ioctl(fd, tcgeta, (char*)ptr)
...
* Release data
%free((char*) ptr)