LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices



Reply
 
Search this Thread
Old 02-02-2010, 12:56 PM   #1
fguihot
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 http://en.wikipedia.org/wiki/Tar_(file_format), 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, 01:04 PM   #2
mjones490
Member
 
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:

Quote:
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, 03:01 AM   #3
fguihot
LQ Newbie
 
Registered: Dec 2009
Posts: 4

Original Poster
Rep: Reputation: 0
Umpf!!!


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


Reply

Tags
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 12:09 PM
how to install a software from the .tar.gz file format ?f screwdriver Linux - Newbie 5 07-14-2008 02:39 PM
what is .tar file format and how do i unzip it jafryar Linux - Newbie 5 12-01-2007 06:45 PM
Quick...Someone Tell Me How To Open a Tar File in .tgz format njschroe Linux - Software 3 06-10-2005 05:58 AM


All times are GMT -5. The time now is 05:04 PM.

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