Iostreams and Tarballs?

Hello list, I am wanting to manage a file format used by another application in my own application. They have a tar.gz file, renamed to something else. In it, there is an XML file and some .wav sound files. Can I use Boost to handle this? I would want to parse the XML from the archive, and then load a few of the sound files. What I don't want to do is something cheesy like call the tar program from mine! That's'orrible :) Cheers for any help, and code (pseudo or otherwise) would be great. Or just a yes or no you can/can't do that would be a start. Cheers all, Gaz

Gareth Foster wrote:
Cheers for any help, and code (pseudo or otherwise) would be great. Or just a yes or no you can/can't do that would be a start.
its possible, but you'll have to write a 'tar' filter to allow you to extract the XML file, (Iostreams should already deal with the gzip). If you only need to pick out a single file from an input stream, it shouldn't be too hard to deal with. You'll 'just' have to parse the tar headers till you match the file(s) you want, then pass them as the output of your filter onto the next stage, which can be your XML decoding/whatever. dealing with the multiple files though depends on if your program needs them 'in order' in some way, and if that order is the one the external program writes the tar archive in, otherwise you'll want to deal with rewindable stream or do a multiple pass algorithm or something, but thats more an application issue. Kevin -- | Kevin Wheatley, Cinesite (Europe) Ltd | Nobody thinks this | | Senior Technology | My employer for certain | | And Network Systems Architect | Not even myself |

Kevin Wheatley escreveu:
Gareth Foster wrote:
Cheers for any help, and code (pseudo or otherwise) would be great. Or just a yes or no you can/can't do that would be a start.
its possible, but you'll have to write a 'tar' filter to allow you to extract the XML file, (Iostreams should already deal with the gzip). If you only need to pick out a single file from an input stream, it shouldn't be too hard to deal with.
An interesting approach to solve the above limitation would be a Tar-Archive-Filesystem Library. -- Pedro Lamarão Desenvolvimento Intersix Technologies S.A. SP: (55 11 3803-9300) RJ: (55 21 3852-3240) www.intersix.com.br Your Security is our Business
participants (3)
-
Gareth Foster
-
Kevin Wheatley
-
Pedro Lamarão