Home » Community » Newbie corner » tar library for u++
|
|
Re: tar library for u++ [message #29393 is a reply to message #29357] |
Mon, 18 October 2010 12:14 |
pepe11
Messages: 16 Registered: June 2006 Location: Slovakia
|
Promising Member |
|
|
Hi,
I tried to write something that I wanted to see the content. But it is very simply.Here's your test:
#include <Core/Core.h>
using namespace Upp;
struct star {
char name[100];
char filemode[8];
char ownerID[8];
char GroupID[8];
char size[12];
char lmodtime[12];
char crc[8];
char link_ind;
char lname[100];
};
struct ustar {
char ver[2];
char ownername[32];
char Groupname[32];
char devmajnum[8];
char devminnum[8];
char fileprefix[155];
};
CONSOLE_APP_MAIN
{
FileIn fi;
star tt;
ustar utt;
String data;
int ifilesize;
long lfilepos;
fi.Open("C:\\TEMP\\rest\\Bratislava.tar");
while(!fi.IsEof())
{
lfilepos=fi.Get(&tt,sizeof(star));
if(fi.Get(6)=="ustar ")
lfilepos+=fi.Get(&utt,sizeof(ustar))+6;
else
fi.SeekCur(-6);
fi.Get(512 - (lfilepos % 512));
if(tt.link_ind != 0) Cout() << Format("%d , %s " ,tt.link_ind-48,tt.name);
if(tt.link_ind == '0' || tt.link_ind == '\0')
if(atoi(tt.size)>0)
{
sscanf(tt.size,"%o",&ifilesize);
data = fi.Get(ifilesize);
Cout() << Format("%d " ,ifilesize);
fi.Get(512 - (ifilesize % 512));
}
Cout() << "\n";
}
getchar();
}
pepe
|
|
|
|
Goto Forum:
Current Time: Wed Apr 24 16:14:53 CEST 2024
Total time taken to generate the page: 0.04387 seconds
|