You don't have to cast nor to use unions.
The scheme is:
Qt Code:
QByteArray ba; ba.resize(1000); int x, y, z; char *data = ba.data(); memcpy(data, &x, sizeof(x)); memcpy(data+sizeof(x), &y, sizeof(y)); memcpy(data+sizeof(x)+sizeof(y), &z, sizeof(z));To copy to clipboard, switch view to plain text mode
Bookmarks