Hi...

open (IMAGE, $imgfile) || die "Can't Open $imgfile\n";
        binmode(IMAGE);

open (OUTPUT, ">$outputfile") || die "Can't Open $outputfile\n";
        binmode(OUTPUT);
my $buf;
my $bufSize = 4096;
while (read(IMAGE,$buf,$bufsize)) { print OUTPUT $buf;}

Yours,

Yaron Kahanovitch
----- Original Message -----
From: "Cheater" <[EMAIL PROTECTED]>
To: beginners@perl.org
Sent: 01:00:32 (GMT+0200) Africa/Harare שבת 28 יולי 2007
Subject: Read and Write Image Files

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);


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to