C++ lühikursus 3

From ICO wiki
Revision as of 09:37, 27 October 2011 by Mernits (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search


Sissejuhatus

STDOUT QTextStream QFile


Faili kirjutamine

#include <QTextStream>
#include <QFile>

QFile data("kalasaba.txt");

if (data.open(QFile::WriteOnly)) {
     QTextStream out(&data);
     out << "See rida läheb faili!" << endl;
   }


Standardväljundisse kirjutamine

#include <QTextStream>
#include <QFile>

QTextStream sout(stdout);
sout<<"See rida läheb standardväljundisse"<<endl;