#include#include int main(){ QString myString = "Hello World!"; std::cout << myString.c_str() << std::endl; return 0; }
#includeThis example converts a QString to an std::string using the toStdString function and then uses the c_str function to get a const char pointer to the internal char array. Package library: Qt, Standard C++ Library.#include int main(){ QString myString = "Hello World!"; std::string newString = myString.toStdString(); const char* charString = newString.c_str(); //Do something with the char array return 0; }