Why do you use std::string for binary data? It should be safe anyway (contrary to using QString)... You should simply use QByteArray and its data() method if you need to operate on the raw data directly.