That's because you have what's commonly known as a "nul" byte in that file. A nul byte has a value of zero, and is probably being treated by perl as false. What you want instead is not to rely on what getc returns, but merely on whether getc returns something that is defined or not (it returns undef at the end):
That solves the problem.while (defined(my $ch = getc(FILE))) {
In reply to Re: Unable to read in a .bin file.
by Tanktalus
in thread Unable to read in a .bin file.
by begae60
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |