![](/img/trans.png)
[英]zlib gzopen() returns a compressed file stream. Does it decompress the file?
[英]wxImage to Zip file via stream. Possible?
我正在尝试使用wxZipOutputStream写出一个zip文件。 该代码来自该论坛,并且与xml文件一起使用(当我使用wxTextOutputStream时)。 现在,我试图包含一个图像文件,但是wxImage类中的SaveFile函数需要一个wxOutputStream类,但是wxTextOutputStream / wxDataOutputStream没有基类,因此我无法对其进行编译。 我只想将一个wxImage和一个xml文件写到一个zip文件中。 我该怎么办?
//convert stream to zip file.
wxFFileOutputStream out(m_loaded_filename.GetFullPath());
wxZipOutputStream zip(out);
// wxTextOutputStream txt(zip);
wxDataOutputStream txt(zip);
zip.PutNextEntry("my.xml");
txt << xmltext;
...
...
...
//value is wxImage*
//key is wxString
zip.PutNextEntry(key); //filename
if(value->IsOk())
{
value->SaveFile(zip); //compiler throws error.
}
类型转换是否起作用:
value-> SaveFile((wxOutputStream&)zip);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.