1

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. The "pictureFrame->picture().data()" is char* buffer;

I've just tried to display cover art in gtk+ window. But I've recieved error - argument of type char* is incompatible with parameter of type "const guchar*".

I know, I have to convert char* buffer to unsigned char buffer, but I don't know how. 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

1
  • 5
    reinterpret_cast. Or you could just copy the whole thing but that's very needlessly inefficient. Commented Dec 4, 2015 at 22:06

1 Answer 1

1

When you're down in the dirt, you just have to get dirty! Something like (yuk!):

fwrite(reinterpret_cast<unsigned char*>(pictureFrame->picture().data()), pictureFrame->picture().size(), 1, fout);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.