in reply to Re: Reading past EOF characters in tar files?
in thread Reading past EOF characters in tar files?

Sorry, OK, my bad. It's the while loop quitting. But why does this:

while (my $char = &getchar ) {

return false when $getchar returns a \0 ? It's still a successful assignment, so I thought it would be true.

BTW thanks for the tip about od. I hadn't seen that one before.

____________________
Jeremy
I didn't believe in evil until I dated it.

Replies are listed 'Best First'.
Re: Re: Re: Reading past EOF characters in tar files?
by Cubes (Pilgrim) on Jul 24, 2001 at 09:04 UTC
    Without looking things up, I'm thinking that because the value being assigned (and thus the value of the assignment) is zero, the conditional is turning up false. I think what you really want to do is test the gotten char against the empty string.
Re: Re: Re: Reading past EOF characters in tar files?
by bikeNomad (Priest) on Jul 24, 2001 at 19:37 UTC
    What does getchar return? Does it return a number (the numeric value of the character) or a string with the character?

    In any event, you're going to have problems with that test. If getchar returns the numeric character value, it's going to stop at the first NUL (0) character. If it returns the character itself, it'll stop if the character is "0" (0x30).