simakov.artem Posted May 31, 2018 Share Posted May 31, 2018 Hi! I have QT app, which send me some data. I need this data in raw (i.e. in HEX, not ASCII or smt else). How can I do this through Unigine API? For test I'm using usage example from documentation (ClientSocket class only, C++): I've recieved messages in this form - "Z4�w|" - but I need this - "5a 34 f9 77 7c 03 00 00 43 4f 52 42 41 54 48 59 03 00 00 00 00 00 00 00 00 00 59 40 1c 00 00 00 cf 02 00 00 fb 51 04 de d0 06 4e 40 a1 f8 31 e6 ae 75 3d 40 00 00 34 43 00 00 00 ..." (892 bytes total). Link to comment
moroz Posted May 31, 2018 Share Posted May 31, 2018 Hi! It seems, that you are reading incoming data not entirely correct. If you are trying to show debug data via Log::message() it will try convert bytes to string first and also will stop at null symbol received ('\0', HEX = 00). You can try this code to output raw data: for (size_t i = 0; i < data_size; ++i) { Log::message("%x ", data[i]); } Thanks! Link to comment
simakov.artem Posted May 31, 2018 Author Share Posted May 31, 2018 Oh, I forget about %x, what a stupid mistake. Thanks, everything ok now! Link to comment
Recommended Posts