[SOLVED] How to convert LPTSTR to QString

Issue

Hi can anyone help me to convert LPTSTR to QString

Solution

You will see in the docs that Qstring provides static function to convert from both ascii and Unicode strings:

  • QString fromAscii ( const char *
    ascii, int len = -1 )
  • QString fromLatin1 ( const char *
    chars, int len = -1 )
  • QString fromUtf8 ( const char * utf8,
    int len = -1 )
  • QString fromLocal8Bit ( const char *
    local8Bit, int len = -1 )
  • QString fromUcs2 ( const unsigned
    short * str )

Check whether you are using ascii or unicode and pick your poison.

Answered By – User2400

Answer Checked By – Terry (BugsFixing Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *