need help reading/writing binary

S

Steve Bennett

Can anyone suggest a good tutorial for reading
and writing binary files in Perl or send me some tips or examples?
I tried using pack and unpack and seek and read
but things don't work as expected so I must be missing
some subtle details.

For example: I tried reading a .RAW image file (no header info) and
writing it back out
using seek read and print.
It almost worked but any part of the image that was black
threw things off. I suspect maybe the zeros (black) were somehow
being interpreted as EOF or NUL or something.
I also suspect that there are issues with word boundries I don't quite
grasp.

Thanks,
-Steve
 
J

Joe Smith

Steve said:
Can anyone suggest a good tutorial for reading
and writing binary files in Perl or send me some tips or examples?

Most important: use binmode(). Use unpack() for reading, pack() for writing.

Create a short program and post it to comp.lang.perl.misc (and not
to comp.lang.perl) for suggestions.
-Joe
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,061
Latest member
KetonaraKeto

Latest Threads

Top