Cheater wrote:
I am attempting to load an image using the standard open function. I then binmode the file handle. But when I attempt to write the image to a new file (to try and create a duplicate), the new file becomes unreadable. I know I could just copy the file itself without opening it, but I need to do it this way. Any help would be greatly appreciated. Here is my code.open (IMAGE, $imgfile) || die "Can't Open $imgfile\n"; binmode(IMAGE); open (OUTPUT, ">$outputfile") || die "Can't Open $outputfile\n"; binmode(OUTPUT); print OUTPUT while (<IMAGE>); close(IMAGE); close (OUTPUT);
My guess is that there is could be some end-of-line translation happening. You could try it like this:
open IMAGE, '<:raw', $imgfile or die "Can't Open '$imgfile' $!"; open OUTPUT, '>:raw', $outputfile or die "Can't Open '$outputfile' $!"; $/ = \1024; # set input line length print OUTPUT while <IMAGE>; close OUTPUT; close IMAGE; John -- Perl isn't a toolbox, but a small machine shop where you can special-order certain sorts of tools at low cost and in short order. -- Larry Wall -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
