syswrite#

Synopsis#

$n = syswrite($fh, $scalar);
$n = syswrite($fh, $scalar, $length);
$n = syswrite($fh, $scalar, $length, $offset);

Description#

Performs an unbuffered write directly to the OS file descriptor.

Writes data from SCALAR to the filehandle using the underlying write(2) system call, bypassing Perl’s buffered I/O layer. When LENGTH is specified, at most that many bytes are written. When OFFSET is given, writing starts from that byte position within the scalar.

Returns the number of bytes actually written, or undef on error (with $! set to the OS errno).

Warning: Do not mix syswrite with buffered I/O (print, say) on the same filehandle.

See also#

sysread, sysseek, print