QString str1 = "Test"; QByteArray ba = str1.toLocal8Bit(); const char *c_str2 = ba.data(); printf("str2: %s", c_str2);