Cari di Perl 
    Perl User Manual
Daftar Isi
(Sebelumnya) Expand filenames using wildcardsCreate a hard link in the filesytem (Berikutnya)
Functions for filehandles, files, or directories

System-dependent device control system call

Daftar Isi

  • ioctl FILEHANDLE,FUNCTION,SCALAR

    Implements the ioctl(2) function. You'll probably first have to say

    1. require "sys/ioctl.ph"; # probably in $Config{archlib}/sys/ioctl.ph

    to get the correct function definitions. If sys/ioctl.ph doesn'texist or doesn't have the correct definitions you'll have to roll yourown, based on your C header files such as <sys/ioctl.h>.(There is a Perl script called h2ph that comes with the Perl kit thatmay help you in this, but it's nontrivial.) SCALAR will be read and/orwritten depending on the FUNCTION; a C pointer to the string value of SCALARwill be passed as the third argument of the actual ioctl call. (If SCALARhas no string value but does have a numeric value, that value will bepassed rather than a pointer to the string value. To guarantee this to betrue, add a 0 to the scalar before using it.) The pack and unpackfunctions may be needed to manipulate the values of structures used byioctl.

    The return value of ioctl (and fcntl) is as follows:

    1. if OS returns: then Perl returns:
    2. -1 undefined value
    3. 0 string "0 but true"
    4. anything else that number

    Thus Perl returns true on success and false on failure, yet you canstill easily determine the actual value returned by the operatingsystem:

    1. $retval = ioctl(...) || -1;
    2. printf "System returned %d\n", $retval;

    The special string "0 but true" is exempt from -w complaintsabout improper numeric conversions.

    Portability issues: ioctl in perlport.

 
Source : perldoc.perl.org - Official documentation for the Perl programming language
Site maintained by Jon Allen (JJ)     See the project page for more details
Documentation maintained by the Perl 5 Porters
(Sebelumnya) Expand filenames using wildcardsCreate a hard link in the filesytem (Berikutnya)