Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^2: Accessing individual bytes of a binary file as numerical values

by jwkrahn (Abbot)
on Apr 24, 2019 at 19:03 UTC ( [id://1232958]=note: print w/replies, xml ) Need Help??


in reply to Re: Accessing individual bytes of a binary file as numerical values
in thread Accessing individual bytes of a binary file as numerical values

I have also modified it to use sysopen and sysseek, for some reason using sysread with the offset parameter doesn't work for me hence the sysseek.
sysread FILEHANDLE,SCALAR,LENGTH,OFFSET sysread FILEHANDLE,SCALAR,LENGTH ... An OFFSET may be specified to place the read data at some plac +e in the string other than the beginning. A negative OFFSET specifi +es placement at that many characters counting backwards from the +end of the string. A positive OFFSET greater than the length of SC +ALAR results in the string being padded to the required size with " +\0" bytes before the result of the read is appended.

In other words, OFFSET determines where inside $BufferByte the data is placed, not where where the data is read from the file.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1232958]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (8)
As of 2024-04-19 07:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found