I'm making tiny e-mail application downloading attachments from server POP3. I used QByteArray::fromBase64 to decode files. I haven't got problems with *.txt files but I can't download and save e.g. *.png files. Images files are dameged. This is my code:


Qt Code:
  1. QByteArray hashAtt;
  2. for( ... )
  3. {
  4. (...)
  5. hashAtt.append(lines[i]);
  6. (...)
  7. }
  8.  
  9. QFile file(fileName);
  10.  
  11. if(file.open(QFile::WriteOnly | QFile ::Text))
  12. {
  13. QByteArray fileAtt = QByteArray::fromBase64(hashAtt);
  14. QTextStream out(&file);
  15. out << hashAtt;
  16. hashAtt.clear();
  17. }
To copy to clipboard, switch view to plain text mode 


What should I do to correctly download all attachments from host?