[英]How can I convert char* buffer to unsigned char buffer
I have got this code to save image from buffer: 我有以下代码可以从缓冲区保存图像:
FILE * fout;
fopen_s(&fout, "output.jpg", "wb");
fwrite(pictureFrame->picture().data(), pictureFrame->picture().size(), 1, fout);
In this way I save cover art using taglib. 这样,我可以使用taglib保存封面。 The "pictureFrame->picture().data()" is char* buffer; “ pictureFrame-> picture()。data()”是char *缓冲区;
I've just tried to display cover art in gtk+ window. 我只是试图在gtk +窗口中显示封面。 But I've recieved error - argument of type char* is incompatible with parameter of type "const guchar*". 但是我收到了错误-char *类型的参数与“ const guchar *”类型的参数不兼容。
I know, I have to convert char* buffer to unsigned char buffer, but I don't know how. 我知道,我必须将char *缓冲区转换为unsigned char缓冲区,但是我不知道如何。 Can anybody help me? 有谁能够帮助我?
pixbuf_loader = gdk_pixbuf_loader_new ();
gdk_pixbuf_loader_write (pixbuf_loader, pictureFrame->picture().data(), pictureFrame->picture().size(), NULL);
Link to gdk_pixbuf_loader documentation 链接到gdk_pixbuf_loader文档
When you're down in the dirt, you just have to get dirty! 当您陷入泥土中时,只需要变脏即可! Something like (yuk!): 像(yuk!):
fwrite(reinterpret_cast<unsigned char*>(pictureFrame->picture().data()), pictureFrame->picture().size(), 1, fout);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.