C++ lühikursus 3

From ICO wiki
Revision as of 15:34, 26 April 2010 by Mernits (talk | contribs) (New page: =Sissejuhatus= STDOUT QTextStream QFile =Faili kirjutamine= <source lang="cpp"> #include <QTextStream> #include <QFile> QFile data("kalasaba.txt"); if (data.open(QFile::WriteOnly))...)
(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;