[resolved] Vector data insertion from C functions

Hello,

I'd like to fill my vector<unsigned char> with a low level "C" function that has this kind of proto :

getData(unsigned char* buffer, unsigned int size);

I'd like to avoid allowing a temporary buffer then copying the data's into a new vector. I'd like the getData function to write the data into the vector as it does for an array.

Thanks
Last edited on
getData (&thevector.front(),x) should do the trick, although you should make sure that the vector is large enough:

thevector.resize(100);
getData(&thevector.front(),100);
Thank you :)
sorry wrong post.
Last edited on
sorry.
Last edited on
Topic archived. No new replies allowed.