1

I need to concatenate several in-memory files to one "standard" (not my own) archive file format using the C language. Compression is not important but it should be one file, i.e. a .tar file. As a result I need to write this archive file to stdout.

In C# I usually use the System.IO.Packaging namespace, but now I need to use C. Most of the examples describe compressing entities of filesystem, but I can't just use the tar utility because I have data in unsigned char * variables, not on disk. I know libtar can help, but all of the examples I have found use temporal files. I'd like to find a solution that does not create temporal files.

Jonny Henly
  • 4,023
  • 4
  • 26
  • 43
xrtt
  • 11
  • 2

1 Answers1

2

tar should be an append-only format. I believe you can use any of the libtar examples except use tar_fdopen with STDOUT_FILENO for fd...