bas7ex.hlp (Topic list)
IOCTL and IOCTL$ Programming Example
                       Example                 Contents  Index  Back
──────────────────────────────────────────────────────────────────────────────
'This example uses the IOCTL statement to set the data mode in the driver
'and the IOCTL$ function to test the data mode when communicating with a
'hypothetical device driver.
 
'Note: The IOCTL$ function works only if the device driver is installed and
'states that it processes IOCTL strings, and only if BASIC performs an OPEN
'statement on the device. Do not run this example in its current form.
 
OPEN "\DEV\ENGINE" FOR OUTPUT AS #1
'Tells the device that the data is raw.
IOCTL #1, "RAW"
 
'If the character driver "ENGINE" responds "false" from the
'raw data mode in the IOCTL statement, then the file is closed.
 
IF IOCTL$(1) = "0" THEN CLOSE 1