[resolved] Vector data insertion from C functions

Jan 14, 2008 at 4:22pm
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 Jan 15, 2008 at 10:03am
Jan 14, 2008 at 7:04pm
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);
Jan 15, 2008 at 10:03am
Thank you :)
Mar 8, 2008 at 3:30am
sorry wrong post.
Last edited on Mar 8, 2008 at 3:31am
Mar 8, 2008 at 4:06pm
sorry.
Last edited on Mar 8, 2008 at 4:06pm
Topic archived. No new replies allowed.