Jul 19, 2002 #1 mather Programmer Mar 24, 2002 3 ZA this maybe a stupid question, but is there a way to convert a string to a const char*. Problem is that the input i recieve is string but the libraries in need to use, wants const char*
this maybe a stupid question, but is there a way to convert a string to a const char*. Problem is that the input i recieve is string but the libraries in need to use, wants const char*
Jul 19, 2002 #2 abbeman Programmer Jul 16, 2002 82 SE There is a string::c_str() method, it returns a c-style string equivalent to the string. eg string str("hello" printf("%s\n", str.c_str()); if you want to use it in place and have a function func() that returns a string you can always do something like: printf("%s\n", func().c_str()); Upvote 0 Downvote
There is a string::c_str() method, it returns a c-style string equivalent to the string. eg string str("hello" printf("%s\n", str.c_str()); if you want to use it in place and have a function func() that returns a string you can always do something like: printf("%s\n", func().c_str());
Jul 19, 2002 Thread starter #3 mather Programmer Mar 24, 2002 3 ZA thanks for the help. Upvote 0 Downvote