I'm having some problems to deal with this stuff. I call a function of a library that returns an unsigned char *. Now what I need is to create a new unsigned char *, allocate the space with the proper size and then put all the data that the function in the lib returns me into the unsigned char * I just created. The first problem is that I don't actually know the size of the unsigned char * that the function will return me, how can I know that? Once I know that how can I copy all the data from the function to the unsigned char * I just created?
Note: I can just do unsigned char *mychar = libfunction(libobject); because libobject will be destroyed after it leaves this function and I need the value returned by libfunction for another stuff in the app(that means that I will get rid of the memory I just allocated in another place, don't worry about mem leaks ).
I hope any of you can help me. Thanks in advance.