A C++ Question
-
Im trying to convert a string to a Const Char* How do I do that? Im using Dev and this is ther error i get: cannot convert `std::basic_string<char, std::char_traits<char>, std::allocator<char> >' to `const char*' for argument `1' to `int system(const char*)' (Im new to C++)
Y*Live Long And Prosper*Y
-
Im trying to convert a string to a Const Char* How do I do that? Im using Dev and this is ther error i get: cannot convert `std::basic_string<char, std::char_traits<char>, std::allocator<char> >' to `const char*' for argument `1' to `int system(const char*)' (Im new to C++)
Y*Live Long And Prosper*Y
False Chicken wrote:
Im trying to convert a string to a Const Char* How do I do that? Im using Dev and this is ther error i get: cannot convert `std::basic_string<char,>, std::allocator >' to `const char*' for argument `1' to `int system(const char*)'
This way! string StrSysCommand = "cls"; system( StrSysCommand.c_str() );
Nibu babu thomas Microsoft MVP for VC++ Code must be written to be read, not by the compiler, but by another human being. Programming Blog: http://nibuthomas.wordpress.com
-
Im trying to convert a string to a Const Char* How do I do that? Im using Dev and this is ther error i get: cannot convert `std::basic_string<char, std::char_traits<char>, std::allocator<char> >' to `const char*' for argument `1' to `int system(const char*)' (Im new to C++)
Y*Live Long And Prosper*Y
False Chicken wrote:
Im new to C++
that doesn't forbids you to interrogate the documentation... the
std::string
class (which is a specialization of thestd::basic_string
template class) has a c_str()[^] member function...[VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]