Detailed assignments between QString and char and strings

  • 2020-04-02 01:47:28
  • OfStack

One, QString assign value to char*

        For example: a QString   QSTR;

                      Char * STR = QSTR. ToLatin1 (). The data (); // this passes the value in QSTR to STR

Char [] is assigned to a string

            Char STR [32].

            String str2 (STR); // this passes the value in STR to str2

Char * is assigned to QString

              For example: char *str1;

                          QString str2;

                          Str2 + = str1; // this passes the values from str1 to str2


Related articles: