Help answer threads with 0 replies.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 02-02-2010, 11:56 AM   #1
LQ Newbie
Registered: Dec 2009
Posts: 4

Rep: Reputation: 0
[TAR] file format

Hi everybody.

I'm trying to build my own untar program, and I am unable to gather the file size from the tar.
I'm working on linux 2.6.11, with gcc.
According to, the file size should be ascii encoded, and at offset d124 from the header.
But when I tar a file of 34 bytes, I read a file size of 42 bytes, which is incorrect.

Here is the hexa code (read with ghex2)
0x30 0x30 0x30 0x30 0x30 0x30 0x30 0x30 0x30 0x34 0x32 0x00
which stand for (Ascii) 00000000042\0
And I have check with ls -l the size of my untared file, which is 34 bytes.

Does anybody has an idea ?
Thanks !
Old 02-02-2010, 12:04 PM   #2
Registered: Sep 2005
Distribution: LFS
Posts: 60

Rep: Reputation: 22
On the wikipedia page you mentioned, in the File Header section, the fourth paragraph begins:

Numeric values are encoded in octal numbers using ASCII digits, with leading zeroes.
Decimal 34 = octal 42.
1 members found this post helpful.
Old 02-03-2010, 02:01 AM   #3
LQ Newbie
Registered: Dec 2009
Posts: 4

Original Poster
Rep: Reputation: 0

I should have read the entire text..
Thanks a lot...


file, format, size, tar

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Error in TAR - tar: GNU features wanted on incompatible archive format. kuldeep.k Linux - General 3 08-14-2009 11:09 AM
how to install a software from the .tar.gz file format ?f screwdriver Linux - Newbie 5 07-14-2008 01:39 PM
what is .tar file format and how do i unzip it jafryar Linux - Newbie 5 12-01-2007 05:45 PM
Quick...Someone Tell Me How To Open a Tar File in .tgz format njschroe Linux - Software 3 06-10-2005 04:58 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:58 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration