views:

650

answers:

4

Does anyone know of any library/code that will enable me to encode and decode .tar formatted data - that I can use in my iPhone project (preferably cocoa)

Thanks in advance

Craig

UPDATE: I've taken a look at the suggested libraries and come to the conclusion that they are making waaaay to much of the problem - so I'm developing the codec myself - it's only a 512byte ASCII header after all - how hard can it be :-)

A: 

Not sure if this will work with cocoa but here you go.

Sean A.O. Harney
Better link: http://code.google.com/p/libarchive/
Peter Hosey
+1  A: 

You might try libxad. This is the library that The Unarchiver, a Mac app, uses.

Peter Hosey
A: 

In fact, libarchive.dylib is included in the iPhone SDK. You just have to add it. The problem is that somehow Apple did not include the header file archive.h. However, first, you do not need the header files if you know for sure the functions you are going to call exist (though the compiler will whine), second, if you do not want the compiler to complain, you can download the header file for libarchive 2.6 and include it in your program ...

If you want to know know to use libarchive, download its source from the web and study the example given (especially minitar). It is really very straightforward.

A: 

Even better link: http://code.google.com/p/libarchive/downloads/detail?name=libarchive-2.6.2.tar.gz&can=2&q=

Version 2.6.2 is included in the iOS 4.0 and 4.1 SDK's. It's not present in 3.2 (or earlier I assume).

If you download that, run ./configure --prefix=$HOME && make && make install and you'll find the two header files placed in $HOME/include

TheSoundOfMatt