start page | rating of books | rating of authors | reviews | copyrights

Programming Perl

Programming PerlSearch this book
Previous: 3.2.165 sysopen Chapter 3
Functions
Next: 3.2.167 system
 

3.2.166 sysread

sysread 

FILEHANDLE

, 

SCALAR

, 

LENGTH

, 

OFFSET

 sysread 

FILEHANDLE

, 

SCALAR

, 

LENGTH

This function attempts to read LENGTH bytes of data into variable SCALAR from the specified FILEHANDLE using read (2). The function returns the number of bytes actually read, or 0 at EOF. It returns the undefined value on error. SCALAR will be grown or shrunk to the length actually read. The OFFSET , if specified, says where in the string to start putting the bytes, so that you can read into the middle of a string that's being used as a buffer. For an example, see syswrite . You should be prepared to handle the problems (like interrupted system calls) that standard I/O normally handles for you. Also, do not mix calls to read and sysread on the same filehandle unless you are into heavy wizardry (and/or pain).


Previous: 3.2.165 sysopen Programming Perl Next: 3.2.167 system
3.2.165 sysopen Book Index 3.2.167 system