base64 image strings

i am trying to load a base64 encoded image string to create a sprite. somewhere there seems to be a mistake though because bool ok always returns false. maybe anybody can help me?

here is the code i’m using:

std::string source = “data:image/png;base64,iVBORw0K……”

int len = 0;
unsigned char buffer;
len = base64Decodesource.c_str, source.length, &buffer);
CCImage
img = new CCImage();
bool ok = img->initWithImageData(buffer,len);

sorry to bother… forgot to strip the metadata in the beginning of the string

hey , i have same issue please can you help me how strip the metadata in the beginning of the string? @aushilfe444