Altertwin
14th March 2010, 15:19
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:
QByteArray hashAtt;
for( ... )
{
(...)
hashAtt.append(lines[i]);
(...)
}
QFile file(fileName);
if(file.open(QFile::WriteOnly | QFile ::Text))
{
QByteArray fileAtt = QByteArray::fromBase64(hashAtt);
QTextStream out(&file);
out << hashAtt;
hashAtt.clear();
}
What should I do to correctly download all attachments from host?
QByteArray hashAtt;
for( ... )
{
(...)
hashAtt.append(lines[i]);
(...)
}
QFile file(fileName);
if(file.open(QFile::WriteOnly | QFile ::Text))
{
QByteArray fileAtt = QByteArray::fromBase64(hashAtt);
QTextStream out(&file);
out << hashAtt;
hashAtt.clear();
}
What should I do to correctly download all attachments from host?