Sounds like a job for QDataStream. Pay attention to the Detailed Description.