Copyright © tutorialspoint.com
Syntax
Definition and UsageLets Perl to call corresponding UNIX C system calls directly. It relies on the existence of the set of Perl header files syscall.ph which declare all these calls. The script h2ph which is normally executed when Perl is installed sets up the syscall.ph files. Each call has the same name as the equivalent UNIX system call with the "SYS_" prefix. As these calls actually pass control to the relevant C system, function care must be taken with passing parameters. The first element in the list used as an argument to syscall() itself is the name corresponding to the UNIX system call (i.e. with the "SYS_" prefix). The next elements in the list are interpreted as parameters to this call. Numeric values are passed as the C type int. String values are passed as pointers to arrays. The length of these strings must be able to cope with any value assigned to that parameter in the call. Return Value
ExampleTry out following example:
It will produce following result:
|
Copyright © tutorialspoint.com