Perhaps this will help:
http://stackoverflow.com/questions/1195675/convert-a-char-to-stdstring

IIRC, something ike

std::string return_string(pointer_to_const_unsigned_char_var);

return_string is an std::string initialized to the value pointed to my the
variable in the initializer. If you want the return_string to have more
space, say to append to it, then you can do:

std::string return_string(pointer_to_const_unsigned_char_var,????) //
replace ???? with the size of the area to be allocated.

ref: http://en.cppreference.com/w/cpp/string/basic_string/basic_string for
the above, in the examples section.

FWIW, I am not a C++ programmer. I have read up a bit on it, but found the
above with a simple Google search.
https://www.google.com/webhp?ie=UTF-8#q=C%2B%2B+std%3A%3Astring+cast



On Tue, Aug 11, 2015 at 9:07 PM, Nicolas J?ger <jagernicolas at legtux.org>
wrote:

> Hi,
> I have some basic problem, but I didn't found the solution so far...
> maybe some people are using C++ and already deal with that problem :
>
> conversion from ?const unsigned char*? to non-scalar type ?std::string
>
> I got the `const unsigned char*` from `sqlite3_column_text()` and I
> want to pass the result as a `std::string` parameter to a C++ function
>
> regards,
> Nicolas J.
> _______________________________________________
> sqlite-users mailing list
> sqlite-users at mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>



-- 

Schrodinger's backup: The condition of any backup is unknown until a
restore is attempted.

Yoda of Borg, we are. Futile, resistance is, yes. Assimilated, you will be.

He's about as useful as a wax frying pan.

10 to the 12th power microphones = 1 Megaphone

Maranatha! <><
John McKown

Reply via email to