views:

256

answers:

3

Writing an app that will include the ability to decompress zip and rar files. I think I'm OK on how to handle the .zips but .rars seem a little more trouble. I noticed that rarlabs has source available but it's C++. Is there a way to compile, wrap or otherwise use this code within an iPhone app?

Reference: http://www.rarlab.com/rar_add.htm

Open to alternate suggestions on how to handle .rar files as well.

I'm still pretty much a newbie so please explain in small words :)

+2  A: 

Objective-C++ allows you to drop C++ code unaltered into an Obj-C source file (and give it a .mm extension). It really is that simple - I didn't believe my eyes the first time I did that, but it was super easy.

You can even mix C++/Obj-C types. See this project for a good example (it's a pretty small library, so it's pretty easy to navigate and see how they structured it): simple-iphone-image-processing. See the Image class in particular.

Ben Collins
Thanks Ben. I may give that a shot.
Greypoint
A: 

If all you need is to decompress RAR files, this library may be much easier for you to compile since it's a single C source file:

http://www.unrarlib.org/features.html

I had looked at compiling the library you mentioned, but there were a lot of errors and it was not initially apparent just how to resolve some of them (file type was not the issue).

Kendall Helmstetter Gelner
Thanks Kendall. I had seen that but noticed it's GPL licensed which means I can't use it in my iPhone app. Drag.
Greypoint
I missed the license part - I see they do have a license that lets you give away the program for free though, if that's an option. Or possibly you could even reimburse them for use if you wanted to work outside the license.
Kendall Helmstetter Gelner
A: 

Could anyone unrar the files in iPhone ?

Thanks