aboutsummaryrefslogtreecommitdiffstats
path: root/doc/codesnippets/doc/src/snippets/code/src_corelib_io_qfile.cpp
blob: c700154c2830110ab65064b2a89d1c0abbff6290 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
//! [0]
file = QFile()
QDir.setCurrent("/tmp")
file.setFileName("readme.txt")
QDir.setCurrent("/home")
file.open(QIODevice.ReadOnly)       # opens "/home/readme.txt" under Unix
//! [0]


//! [1]
def myEncoderFunc(fileName):
//! [1]


//! [2]
def myDecoderFunc(localFileName):
//! [2]


//! [3]

def printError(msg):
    file = QFile()
    file.open(sys.stderr.fileno(), QIODevice.WriteOnly)
    file.write(msg, size(msg))                  # write to stderr
    file.close()
//! [3]


//! [4]
CONFIG += console
//! [4]