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++
tar library for u++ [message #29357] Fri, 15 October 2010 23:07 Go to next message
thundurstruck is currently offline  thundurstruck
Messages: 5
Registered: October 2010
Promising Member

Hi U++ Gurus - I want to have my application write multiple files into a single tar file. Can anyone recommend a ready built tar library to use with U++?

Thanks!

Re: tar library for u++ [message #29359 is a reply to message #29357] Sat, 16 October 2010 00:05 Go to previous messageGo to next message
sergeynikitin is currently offline  sergeynikitin
Messages: 748
Registered: January 2008
Location: Moscow, Russia
Contributor

I use direct call of batch file from U++ program.

SergeyNikitin<U++>( linux, wine )
{
    under( Ubuntu || Debian || Raspbian );
}
Re: tar library for u++ [message #29393 is a reply to message #29357] Mon, 18 October 2010 12:14 Go to previous messageGo to next 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
Re: tar library for u++ [message #29399 is a reply to message #29393] Mon, 18 October 2010 23:18 Go to previous message
thundurstruck is currently offline  thundurstruck
Messages: 5
Registered: October 2010
Promising Member

Thank you for your replies. I was able to successfully create a tar file.
Previous Topic: Usage of DUMPC and other macros by using flags
Next Topic: A trouble with "select" from Oracle DB
Goto Forum:
  


Current Time: Wed Apr 24 16:14:53 CEST 2024

Total time taken to generate the page: 0.04387 seconds