Hello,

I'm reading from a tcp server an integer (4-bytes) data
The tcp server is big endian

On my client, which is a little endian CPU, I've done this :

Qt Code:
  1. qint32 v;
  2.  
  3. ...
  4. sck.read(data, 16);
  5.  
  6.  
  7. #if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
  8. v = ntohl(*((qint32*) data));
  9. #endif
To copy to clipboard, switch view to plain text mode 

Works pretty well, but sounds "old school". Do I have a better way to do that ?

Thanks...