NAME

sysread - fixed-length unbuffered input from a filehandle


SYNOPSIS

sysread FILEHANDLE,SCALAR,LENGTH,OFFSET

sysread FILEHANDLE,SCALAR,LENGTH


DESCRIPTION

Attempts to read LENGTH bytes of data into variable SCALAR from the specified FILEHANDLE, using the system call read. It bypasses stdio, so mixing this with other kinds of reads may cause confusion. Returns the number of bytes actually read, or undef if there was an error. SCALAR will be grown or shrunk so that the last byte actually read is the last byte of the scalar after the read.

An OFFSET may be specified to place the read data at some place in the string other than the beginning. A negative OFFSET specifies placement at that many bytes counting backwards from the end of the string. A positive OFFSET greater than the length of SCALAR results in the string being padded to the required size with ``\0'' bytes before the result of the read is appended.