回复: 大佬来,QString比较尴尬的地方!
#6 [spygg 04-20 22:39]
试试这个...
QString request = ui->request->toPlainText().trimmed();
const auto& bytes = request .toUtf8();
const char *data = bytes.data();
#7 [fsu0413 04-20 22:50]
Before version 7.17.0, strings were not copied. Instead the user was forced keep them available until libcurl no longer needed them.
坑在curl这边,你看一下curl的版本
#8 回 fsu0413 的帖子 [liulin188 04-20 23:40]
fsu0413:Before version 7.17.0, strings were not copied. Instead the user was forced keep them available until libcurl no longer needed them.
坑在curl这边,你看一下curl的版本 (2020-04-20 22:50)
我的是7.37.0,我现在试试你那个方法。
curl应该没问题,因为同样.data()不稳定的问题,我在一个aes加密函数里也出现了。
#9 回 spygg 的帖子 [liulin188 04-20 23:59]
spygg:试试这个...
QString request = ui->request->toPlainText().trimmed();
const auto& bytes = request .toUtf8();
const char *data = bytes.data();
....... (2020-04-20 22:39)
不行啊
#10 [snow_man_0 04-21 00:35]
试试用toLocal8Bit()