Perl Programming/Keywords/ioctl

From Wikibooks, open books for an open world
Jump to navigation Jump to search
Previous: int Keywords Next: join

The ioctl keyword[edit | edit source]

ioctl implements the UNIX function ioctl(2) that manipulates the underlying device parametres of special files. Many operating characteristics of character special files (like terminals) can be controlled with ioctl() requests. The argument FILEHANDLE must be an open file descriptor.

To run this function, one may first request "sys/ioctl.ph";. SCALAR is read or written, depending on the FUNCTION.

The function returns undef, if the operating system returns -1; if the OS returns 0, this function returns the string "0 but true", and the returned number from the OS otherwise.

Syntax[edit | edit source]

  ioctl FILEHANDLE, FUNCTION, SCALAR
Previous: int Keywords Next: join