Thread: Reading compressed files

  1. #1
    Registered User
    Join Date
    Dec 2001
    Posts
    40

    Reading compressed files

    Hi,
    Does anyone know of a library on Solaris that has functions to allow you to read from a compressed file? I have a large number of compressed files that I need to process. I could write a wrapper script that uncompresses the file, passes the uncompressed file as an argument to my program and recompresses it again. But it would be nicer if I could do it all within the program, just passing the compressed file as the argument. Does anyone know of such a library?
    Thanks
    Pete

  2. #2
    Gawking at stupidity
    Join Date
    Jul 2004
    Location
    Oregon, USA
    Posts
    3,218
    There's a zillion and one compressed file formats. Are you referring to files that were compressed with the 'compress' program or something else? Have you tried zlib?
    If you understand what you're doing, you're not learning anything.

  3. #3
    .
    Join Date
    Nov 2003
    Posts
    307
    Read from stdin:
    Code:
    zcat file.Z | myprogram
    ..or .
    uncompress <filename> | myprogram

  4. #4
    Registered User
    Join Date
    Dec 2001
    Posts
    40
    Yes, compressed with the compress utility to produce a .Z file. Have not tried zlib, but I have had a look and there is a zlib.h in /usr/include. I will do a google search and see if I can turn up a function list and maybe some examples of its use.
    Thanks
    Pete

  5. #5
    Gawking at stupidity
    Join Date
    Jul 2004
    Location
    Oregon, USA
    Posts
    3,218
    http://www.dogma.net/markn/articles/...l/zlibtool.htm
    That site should have all the information you need.
    If you understand what you're doing, you're not learning anything.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Reading data from consecutively named files
    By a1pro in forum C Programming
    Replies: 10
    Last Post: 04-15-2005, 01:48 AM
  2. Writing Compressed Image Files
    By BenBartle in forum C++ Programming
    Replies: 1
    Last Post: 03-09-2005, 08:55 PM
  3. A little help reading from files...
    By Invincible in forum C++ Programming
    Replies: 4
    Last Post: 04-03-2002, 10:43 AM
  4. problem reading files in C
    By angelfly in forum C Programming
    Replies: 9
    Last Post: 10-10-2001, 11:58 AM
  5. Need Advice in reading files
    By jon in forum C Programming
    Replies: 4
    Last Post: 10-07-2001, 07:27 AM