If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
I know I can add multiple files with directory structure into a file by using wxZipOutputStream. But my question is can I add files to memory? I tried the following code. It seems that it doesn't work.
Hi,
some time ago i had used the same code, it worked fine. One difference is that i got size of the memory stream by TellO() (i don't remember at the moment why i did that ).
tan wrote:Hi,
some time ago i had used the same code, it worked fine. One difference is that i got size of the memory stream by TellO() (i don't remember at the moment why i did that ).
I tried to replace wxMemoryOutputStream to wxFFileOutputStream. The zip file was written successfully. But the size is also 4. So I think the data is already written to memory buffer already. If this is the case, my next question will be how can I get the buffer data from wxMemoryOutputStream?
I know how to do now. I have to put "size_t bufsize = mem3.GetSize();" after the wxZipOutputStream closed because wxZipOutputStream will do some more actual writing after Close(). Thanks for your help and reminding, tan. Actually it doesn't matter which method to take. The key point is to call them after Close().