I’m having trouble understanding type conversion. i have a vector of
uint8_t values. I’d like to build an ofxOscArgBlob in order to send these values to Open Lighting Architecture .
I am struggling to get this data into an
const char * which can then be placed into
ofxOscArgBlob per the documentation page:
void ofxOscArgBlob::set(const char *_value, unsigned int length)
Thanks in advance
a vector of uint8_t is pretty much the same as char* (except it’s unsigned but i can imagine it won’t make any difference) you just need to access the memory pointer of the data in the vector and cast it to char* like:
blob.set(static_cast<const char*>(vec.data()), vec.size());
where vec is your vec of uint8_t
thanks! I seem to be getting this error:
Static_cast from 'value_type *'(aka 'unsigned char *') to 'const char*' is not allowed
reinterpret_cast instead and that seems to work (it is compiling). Thanks very much for this.