Creating simple WebService in C++ / Qt (acting as server) providing JSON data

后端 未结 2 1371
一生所求
一生所求 2021-01-30 11:33

I need to create a simple web service (being the \"server\"). The goal is to provide some data I do read in an Qt / C++ application as JSON data. Basically a Ja

2条回答
  •  伪装坚强ぢ
    2021-01-30 12:39

    QByteArray ba = dp.toLocal8Bit();
    const char *baChar = ba.data();
    

    You don't need to convert the QByteArray to char array. Response.write() can also be called with a QByteArray.

    By the way: qPrintable(dp) is a shortcut to convert from QString to char array.

提交回复
热议问题