[Qt-interest] Writing file.

Oliver.Knoll at comit.ch Oliver.Knoll at comit.ch
Wed Apr 8 13:08:41 CEST 2009


Sujan Dasmahapatra wrote on Wednesday, April 08, 2009 1:00 PM:

> Thanks friends for the response.But I have written the code exactly
> like below.But its still not writing onto the file. ...
>     QFile filewrite("profile_n.grd");
> 
>     if( filewrite.open(QIODevice::WriteOnly) )
>     {
>         QTextStream out(&filewrite);
>         out << "." << "\n";
>     }
>     else
>     {
>         qDebug() << filewrite.errorString();
>     }

Where do you *close* the file? (Rhetorical question)

No close(), no flush, no bytes written!

Cheers, Oliver
-- 
Oliver Knoll
Dipl. Informatik-Ing. ETH
COMIT AG - ++41 79 520 95 22



More information about the Qt-interest-old mailing list