Why do you need !=0 in your while _expression_?
Sincerely,
Arun Sondhi
CCNP,CCDP
Ph: +1 414.382.0206
Extn: 20206
[EMAIL PROTECTED]
Sent by: [EMAIL PROTECTED] 10/28/2003 08:22 AM
|
To: [EMAIL PROTECTED] cc: Subject: Buffer behavior as in C? |
Hello guys,
I am doing the following :
reading from a binary file with sysread() into a buffer 1024 bytes.
What I would like to do is to iterate through each byte within this buffer ( somekind of pointer to byte in C ).
I do not seem to see the solution. Any ideeas ? Here is a piece of my code.
my $refBuf;
while ( (my $lengthRef=sysread(REF_FILE, $refBuf, 1024))!= 0 )
{
for (my $i=0; $i < $lengthRef ; $i++ )
{
#do something with the $i-th byte from this buffer
}
}
Thanks.
Nicu