Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Reading past EOF characters in tar files?

by Cubes (Pilgrim)
on Jul 24, 2001 at 08:45 UTC ( [id://99236]=note: print w/replies, xml ) Need Help??


in reply to Reading past EOF characters in tar files?

Does it quit at the same character ('od -c' is your friend here), or the same line or byte position in the file? What about other files, with different data? What happens if you construct a file with the suspect character in different positions, and feed that in?

A code snippet of at least the part that's quitting on you would be helpful, as would some readable representation of the data it's choking on.

  • Comment on Re: Reading past EOF characters in tar files?

Replies are listed 'Best First'.
Re: Re: Reading past EOF characters in tar files?
by jepri (Parson) on Jul 24, 2001 at 08:59 UTC
    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.

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

Re: Re: Reading past EOF characters in tar files?
by petdance (Parson) on Jul 24, 2001 at 19:42 UTC
    Aside: for those of you who use vim, you have a snazzy little tool called xxd that does all the stuff od -c does, and then some.

    xoxo,
    Andy
    --
    <megaphone> Throw down the gun and tiara and come out of the float! </megaphone>

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://99236]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (3)
As of 2024-09-08 00:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.