c++ - QByteArray to QString to std::stringstream doesn't work -


किसी को पता है क्यों

  QString Lulu (डेटा); // डेटा QByteArry (QNetworkrequest से) std :: stringstream streamedJson; // कस्टस्ट्रिंग लुलु (डेटाडेटा ()); qDebug () & lt; & lt; "लुलु:" & lt; & lt; लुलु; // यहां पर यह सही स्ट्रिंग देखता है; जेसन & lt; & lt; Lulu.toStdString (); QDebug () & lt; & lt; "स्ट्रीमेडजसन:" & lt; & lt; StreamedJson; // यहां 0x7fffc9d46568 के विचार हैं   

काम नहीं करता है? क्यों स्ट्रिंग को यहां न देखें? अंत में मैं इसे पार्स करूँगा और पार्स स्ट्रिंग दे दूँगा

  boost :: property_tree :: ptree propertyTree; Try {boost :: property_tree :: json_parser :: read_json (streamedJson, propertyTree); } पकड़ (बढ़ावा :: संपत्ति_ट्री :: जेसन_पार्सर :: जेसन_पार्सर_आपर & amp; पूर्व) {qDebug () & lt; & lt; "पूर्व:" & lt; & lt; ex.what (); // यह और लुलु समान (पृथक) स्ट्रिंग qDebug ("गुणधर्म त्रुटि") को देखता है; }   

इस समय यह केवल "गुणधर्म त्रुटि" को देखता है लेकिन इसे अपने कंसोल में पार्स किए गए स्ट्रिंग को प्रिंट करना चाहिए

QString चर के रूप में नीचे समझाया गया है और मान को std :: string चर में इसे std :: stringstream में धकेलने से पहले डालने का प्रयास करें।

  QString Lulu = QString (डेटा); Std :: stringstream streamedJson; Std :: string strLulu = Lulu.toStdString (); StreamedJson & lt; & lt; strLulu; QDebug () & lt; & lt; "स्ट्रीमेडजसन:" & lt; & lt; streamedJson;   

आशा है कि यह मदद करता है।

Comments

Popular posts from this blog

Out of index C/C++ -

algorithm - Graph cut with python: How to set up the graph correctly? -

objective c - how Set autolayout for multiple dynamic buttons and labells in iOS? -