'type cast' : cannot convert from 'std::string' to 'char *'
-
Can any body help me to convert std::string to char * ? Thanks in advance.I am working on win32(UNICODE)api in vs2005.
"Success lies not in the result , But in the efforts !!!!!" Amit Mistry - petlad -Gujarat-India
-
Can any body help me to convert std::string to char * ? Thanks in advance.I am working on win32(UNICODE)api in vs2005.
"Success lies not in the result , But in the efforts !!!!!" Amit Mistry - petlad -Gujarat-India
Use the c_str() member function:
std::string strMyString = "Test";
char* pTemp = strMyString.c_str();
Cédric Moonen Software developer
Charting control [v1.2 - Updated] -
Can any body help me to convert std::string to char * ? Thanks in advance.I am working on win32(UNICODE)api in vs2005.
"Success lies not in the result , But in the efforts !!!!!" Amit Mistry - petlad -Gujarat-India
amitmistry_petlad wrote:
Can any body help me to convert std::string to char * ?
Use
string::c_str
. e.gstd::string sTest("Test");
const char* ptest = sd.c_str();
Prasad MS MVP - VC++
-
amitmistry_petlad wrote:
Can any body help me to convert std::string to char * ?
Use
string::c_str
. e.gstd::string sTest("Test");
const char* ptest = sd.c_str();
Prasad MS MVP - VC++
prasad_som wrote:
const char* ptest = sd.c_str();
of course should be
sTest.c_str()
. :)If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
-
prasad_som wrote:
const char* ptest = sd.c_str();
of course should be
sTest.c_str()
. :)If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
:-O
Prasad MS MVP - VC++