Cheap web site hosting service by Active-Venture.com
  

 Back to Index

sysseek

sysseek FILEHANDLE,POSITION,WHENCE

Sets FILEHANDLE's system position in bytes using the system call lseek(2). FILEHANDLE may be an expression whose value gives the name of the filehandle. The values for WHENCE are 0 to set the new position to POSITION, 1 to set the it to the current position plus POSITION, and 2 to set it to EOF plus POSITION (typically negative).

Note the in bytes: even if the filehandle has been set to operate on characters (for example by using the :utf8 I/O layer), tell() will return byte offsets, not character offsets (because implementing that would render sysseek() very slow).

sysseek() bypasses normal buffered io, so mixing this with reads (other than sysread, for example >&lt or read()) print, write, seek, tell, or eof may cause confusion.

For WHENCE, you may also use the constants SEEK_SET, SEEK_CUR, and SEEK_END (start of the file, current position, end of the file) from the Fcntl module. Use of the constants is also more portable than relying on 0, 1, and 2. For example to define a "systell" function:

 
	use Fnctl 'SEEK_CUR';
	sub systell { sysseek($_[0], 0, SEEK_CUR) }  

Returns the new position, or the undefined value on failure. A position of zero is returned as the string "0 but true"; thus sysseek returns true on success and false on failure, yet you can still easily determine the new position.

 

  

 

Domain registration - Domain registration service and cheap domain transfer
 

Cheap domain name: Register domain name -
Register domain name services from just
$8.95/year only
 

Register domain name search -
Register domain or buy domain name registration and cheap domain transfer at low, affordable price.

© 2002-2004 Active-Venture.com Web Site Hosting Service

 

[ The ultimate metric that I would like to propose for user friendliness is quite simple: if this system was a person, how long would it take before you punched it in the nose.   ]

 

 
 
 

Disclaimer: This documentation is provided only for the benefits of our web hosting customers.
For authoritative source of the documentation, please refer to http://www.perldoc.com