I have a Data-Url of a file as std:string.
The base64 encoded data has to be decoded and then be passed to this function:
open (const byte * data, long size)
So first i extract the encoded data
size_t pos = dataurl.find_first_of(',');
std::string encoded = dataurl.substr(spos + 1);
Then i use this base64 decoder
std::string decoded = base64_decode(encoded);
Well, how can i cast ‘decoded’ of type string to byte*?
The following code produces an error
open((byte *)decoded.c_str(), decoded.size() + 1);
//>>error: 'byte' was not declared in this scope
/EDIT: so there is a typedef
typedef uint8_t byte
the encoded data is an image!
It looks like you are removing
const.c_str()returns aconst char *. Your cast should be(const byte *).