thx wysota.

QTextStream slove my 1st problem in writing text to a file.
QFile file(filename);
file.open(QIODevice::WriteOnly);
QTextStream textstream(&file);
textstream << text;
i apply it in writing a picture file with QDataStream.
but nothing appear in the picture file.
wat should i do?