Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
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 Go to previous messageGo to previous message
pepe11 is currently offline  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
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Usage of DUMPC and other macros by using flags
Next Topic: A trouble with "select" from Oracle DB
Goto Forum:
  


Current Time: Fri Jul 18 14:37:45 CEST 2025

Total time taken to generate the page: 0.03904 seconds