Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > need help reading/writing binary

Reply
Thread Tools

need help reading/writing binary

 
 
Steve Bennett
Guest
Posts: n/a
 
      08-25-2004
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
 
Reply With Quote
 
 
 
 
Joe Smith
Guest
Posts: n/a
 
      08-25-2004
Steve Bennett wrote:

> 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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
x86 binary runs; x86_64 binary throws segfault Don C Programming 60 03-19-2010 05:58 AM
(8-bit binary to two digit bcd) or (8-bit binary to two digit seven segment) Fangs VHDL 3 10-26-2008 06:41 AM
writing binary file (ios::binary) Ron Eggler C++ 9 04-28-2008 08:20 AM
A 64-bit binary returning a value to a 32-bit binary? spammenotplui31@yahoo.ca C Programming 12 04-08-2007 07:02 AM
Re: ostreams, ios::binary, endian, mixed binary-ascii Marc Schellens C++ 8 07-15-2003 12:27 PM



Advertisments