1

so I'm making an iPhone app and part of the code is in C++. I'm loading an 80mb file which is basically just a lot of text, but I notice that same file when zipped is just 17mb which would be easier to open for an iPhone. How can I compress this file and at runtime decompress and read the decompressed string?

Duxducis
  • 317
  • 4
  • 17
  • I know I can use zlib, but examples show me how to compress a file into another. Can someone give me an example of how to get a text file, compress it with zlib and later load it into memory as a string in C++? – Duxducis Oct 28 '12 at 19:57
  • Your comment is ambiguous..You have seen example which use zlib to compress into another file and you wish to load it now..so you can load the new file into memory right? Did you check this: http://zlib.net/zpipe.c – mots_g Oct 30 '12 at 08:50

3 Answers3

4

You can use zlib, or a more c++ approach Boost zlib filters.

Daniel
  • 30,896
  • 18
  • 85
  • 139
0

You could use zlib,

http://www.zlib.net/zlib_how.html

There's a thread about c++ examples here:

What easy zlib tutorials are there?

Community
  • 1
  • 1
Johan Lundberg
  • 26,184
  • 12
  • 71
  • 97
0

http://zlib.net/ is a free and easy compression libary

Benedikt Bünz
  • 648
  • 7
  • 22