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
In reply to Re: Preoblem Reading Encrypted file on a Win32 box
by tachyon
in thread Preoblem Reading Encrypted file on a Win32 box
by Klem
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |