I am trying to modify the CArchiveExtractCallback class from the Client7z to get files extracted into memory.
I suppose that the relevant part of code is:
_outFileStreamSpec = new COutFileStream;
if (!_outFileStreamSpec->Open(fullProcessedPath, CREATE_ALWAYS))
PrintString((UString)L"can not open output file " + fullProcessedPath);
_outFileStream = outStreamLoc;
*outStream = outStreamLoc.Detach();
I think that I should use COutMemStream instead of COutFileStream, but I have no idea about what is the right way to use it. Is there any code sample?
The idea is extract a single file (f.e: file at index 3), and after the extraction is finished get the raw data from CArchiveExtractCallback.
If unpackSize is known, you can use CBufPtrSeqOutStream:
CBufPtrSeqOutStream *outStreamSpec = new CBufPtrSeqOutStream;
If unpackSize is unknown (gzip, bzip2), you can use CDynBufSeqOutStream.
Thank you so much Igor, now it is working fine.
I'm trying to do the same thing, I was just wondering, where exactly is this "data" that is used with Init()?
You must allocate buffer for uncompressed data.
The "data" is a pointer to that buffer.
I realized thats what I must do, don't know what I was thinking. Thanks so much for the reply.