%IOCTL

%IOCTL


%GETPPID Index Level %KILL
Syntax variable = %IOCTL( file.descriptor, request, arg )
Category BASIC
Type C Function
Description A general purpose control function which passes arguments "request" and "arg" to the device designated by "file.descriptor".

The format of the arguments is device-specific. Note that most of the time, these arguments will be binary data that must be kept out of FlashBASIC data space. See the example below.
Options
See Also c function CFUNCTION %TTYNAME
Example * 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 )
Warnings 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 Pick tools to access a device. For example, "execute 'set-baud /dev/tty15,9600'" will work on all Pick implementations, while the corresponding Unix ioctl varies widely.
Compatibility D3/Unix
%GETPPID Index Level %KILL