Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7085415
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:25:18+00:00 2026-05-28T07:25:18+00:00

I have almost tar.gz file. I need to skip some bytes before unpacking and

  • 0

I have almost tar.gz file. I need to skip some bytes before unpacking and then untar it, change something and pack it again.

 #!perl

 open (my $src, "<", $path) or die $!;
 binmode($src);
 seek($src, $magicNumber,0);

 open(my $tgz, ">", $path . ".tar.gz");
 binmode($tgz);

 #while(<$src>){
 #    print $tgz $_;
 #}
 my $n; my $data;
 while(($n = read $src, $data, 4) != 0){
     print $tgz $data;
 }

Why when using uncommented version generetes shorter file than uncomented (byte skipped in the middle). I would understand if end of file would be corrupted but generated files differ somewhere in the middle. Any explanation for this?

Unfortunately I am not allowed to upload file that reproduces problem.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T07:25:18+00:00Added an answer on May 28, 2026 at 7:25 am

    Using constructs like foreach(<$src>) for binary files is generally not very good since it reads in line mode (and binary files does not have the concept of lines).

    If you do a binary compare between your files I would guess that the bytes you are missing is either a CR or a LF.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have almost tried everything but for some reason it is not working <StackPanel
Some high traffic sites seem to have almost crazy sprited images with almost everything
...what does it mean? I have almost no experience with jQuery, and need to
I'm having some problems with the control of IE through C#. I have almost
HI, I have almost solved this but have now got stuck! What I need
I have almost 200,000 html pages and I need to figure out the height
Currently I have some theoretically background in regular expression, but I have almost never
I have almost 100MB of example.sql file. (Actually data export file from another database)
I have almost the worst spec in the world. An application that exists and
I have almost 800 MB and over 31,000 files in hundreds of subfolders at

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.