How to convert from a QTString type to String type in C++ .......... please help me?

i have a file name stored in a varible of type qtstring and i need to move it into a variable of type string.... but i don't know how .... can you help me pleeeeeeeeeeeez.

1 Answer

Relevance
  • 1 decade ago
    Favorite Answer

    #include <QString>

    #include <string>

    using namespace std;

    const std::string & qt2string(

    std::string & dest, const qtstring & src )

    {

    dest = (const char*) src.data();

    return dest;

    }

Still have questions? Get your answers by asking now.