I have a library function from which I should pass same data types to the main application .
Thus my question is - how do I pass a std::vector<char>
to a C style function that expects char*
. Here is what I have tried
// function to apply on char
void somefunction (char* c_buf, int* c_buf_len)
// main function
typedef std::vector<char> Buf;
void (Buf& buf)
{
// first convert `buf` to char and call function
somefunction(char_buf, char_buf_len)
// Now convert buf to vector and do something with it..
}