Qt QString转char[]数组

QString s1="1234456";
char str[20]={0};
strcpy(str,s1.toStdString().c_str(),strlen(s1.length()));