in reply to Preoblem Reading Encrypted file on a Win32 box

Try this:

open IN, "out.txt" or die "Can't open out.txt for reading, Perl says $ +!"; print "Want ", (-s IN), "\n"; binmode IN; { local $/; # undef $/ so we read the whole file in $data = <IN>; } print "Got ", length $data;

This will work fine. binmode() is required when dealing with binary files on Win32 to supress Perl's automagical line ending conversion. Typically you would use read() in a while() loop to grap a chunk of bytes to process. If you just want the whole file it is easier to just grab it as shown. Note that read() will not always reliably give you X bytes when you ask for X bytes...

cheers

tachyon

s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print

Replies are listed 'Best First'.
Re: Re: Preoblem Reading Encrypted file on a Win32 box
by Klem (Initiate) on Dec 21, 2001 at 01:10 UTC
    binmode worked like a champ! Thanks for the help. KLEM