×
Namespaces

Variants
Actions
Revision as of 22:03, 17 September 2009 by vkmunjpara (Talk | contribs)

How to write data to a file in Qt

From Nokia Developer Wiki
Jump to: navigation, search
{{{width}}}
{{{width}}}


Article Metadata
Tested with
Devices(s): Emulator
Compatibility
Platform(s): S60 3rd Edition FP1, S60 3rd Edition FP2, S60 5th Edition
Symbian
Article
Keywords: QFile, QTextStream,Qstring, Text Label
Created: (07 Jan 2009)
Last edited: vkmunjpara (17 Sep 2009)


Overview

This code snippet demonstrates File write operation in Qt for S60.

Preconditions


Source File

#include <QFile>
#include <QApplication>
#include <QLabel>
#include <QString>
#include <QTextStream>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QFile file("c://out.txt");
file.open(QIODevice::WriteOnly | QIODevice::Text);
QTextStream out(&file);
out << "This file is generated by Qt \n";
file.close();
return app.exec();
}
  • Above code will generate the file out.txt into c: of your emulator. You can find it at this path.
  • For 5th edtion SDK
 C:\S60\devices\S60_5th_Edition_SDK_v0.9\epoc32\winscw\c
  • For 3rd edition SDK
 C:\Symbian\9.3\S60_3rd_FP2_Beta\epoc32\winscw\c
2198 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×