T
Tony
Hi,
I am trying to read the last 500 bytes of a file. I'm trying to use
sysread command, I have read the docs for it on cpan and it seems the
right thing to use.
My only problem is when i spcify a negative offset it fails with the
following error "Offset outside string at test.pl line 30.".
here is the line it is complaing about
sysread(F,$string,500,-500);
I have tried escaping the minus sign , putting it into a var and using
eval and they all come back with the same error.
Heres the paragraph from cpans docs
"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 characters 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."
should this work or is it just me reading the distructions wrong.
thanks
Tony
I am trying to read the last 500 bytes of a file. I'm trying to use
sysread command, I have read the docs for it on cpan and it seems the
right thing to use.
My only problem is when i spcify a negative offset it fails with the
following error "Offset outside string at test.pl line 30.".
here is the line it is complaing about
sysread(F,$string,500,-500);
I have tried escaping the minus sign , putting it into a var and using
eval and they all come back with the same error.
Heres the paragraph from cpans docs
"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 characters 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."
should this work or is it just me reading the distructions wrong.
thanks
Tony