[Qt-interest] Writing file.

Sujan Dasmahapatra sdh at lmglasfiber.com
Wed Apr 8 12:59:46 CEST 2009


Thanks friends for the response.But I have written the code exactly like
below.But its still not writing onto the file.I am checking the file
during execution of each line through debugger its creating the file if
it doesn't exist but not writing anything onto it.what other problems
could arise can anyone tell me plss.

    QFile filewrite("profile_n.grd");

    if( filewrite.open(QIODevice::WriteOnly) )

    {

        QTextStream out(&filewrite);

        out << "." << "\n";

    }

    else

    {

        qDebug() << filewrite.errorString();

    }

 

 

Kind regards, 
Sujan Dasmahapatra
  

From: Tim W [mailto:timpie.w at gmail.com] 
Sent: Wednesday, April 08, 2009 3:59 PM
To: Sujan Dasmahapatra
Cc: qt-interest at trolltech.com
Subject: Re: [Qt-interest] Writing file.

 

>Can anyone please check whats wrong in this why it's not writing the
data onto the file.    

 

The file object will telll you what is wrong ...

 

    QFile filewrite("profile_n.grd");

    if( filewrite.open(QIODevice::WriteOnly) )

    {

        QTextStream out(&filewrite);

        out << "." << "\n";

    }

    else

    {

        qDebug() << filewrite.errorString();

    }

 

---
An Apple a day keeps Windows away

ACCU - http://www.accu.org - Professionalism in Programming. 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090408/36d265b5/attachment.html 


More information about the Qt-interest-old mailing list