File: qfile.html

package info (click to toggle)
qt-embedded 2.3.2-3
  • links: PTS
  • area: main
  • in suites: woody
  • size: 68,608 kB
  • ctags: 45,998
  • sloc: cpp: 276,654; ansic: 71,987; makefile: 29,074; sh: 12,305; yacc: 2,465; python: 1,863; perl: 481; lex: 480; xml: 68; lisp: 15
file content (348 lines) | stat: -rw-r--r-- 22,619 bytes parent folder | download
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Qt Toolkit - QFile Class</title><style type="text/css"><!--
h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }body { background: white; color: black; }
--></style>
</head><body bgcolor="#ffffff">

<table width="100%">
<tr><td><a href="index.html">
<img width="100" height="100" src="qtlogo.png"
alt="Home" border="0"><img width="100"
height="100" src="face.png" alt="Home" border="0">
</a><td valign=top><div align=right><img src="dochead.png" width="472" height="27"><br>
<a href="classes.html"><b>Classes</b></a>
-<a href="annotated.html">Annotated</a>
- <a href="hierarchy.html">Tree</a>
-<a href="functions.html">Functions</a>
-<a href="index.html">Home</a>
-<a href="topicals.html"><b>Structure</b></a>
</div>
</table>

<h1 align=center>QFile Class Reference</h1><br clear="all">
<p>
The QFile class is an I/O device that operates on files.
<a href="#details">More...</a>
<p>
<code>#include &lt;<a href="qfile-h.html">qfile.h</a>&gt;</code>
<p>
Inherits <a href="qiodevice.html">QIODevice</a>.
<p><a href="qfile-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li><div class="fn"><a href="#b097df"><b>QFile</b></a>()</div>
<li><div class="fn"><a href="#9f0c84"><b>QFile</b></a>(constQString&amp;name)</div>
<li><div class="fn"><a href="#17ae38"><b>~QFile</b></a>()</div>
<li><div class="fn">QString<a href="#f6ec78"><b>name</b></a>()const</div>
<li><div class="fn">void<a href="#f0c76b"><b>setName</b></a>(constQString&amp;name)</div>
<li><div class="fn">typedef<b>QCString</b>(*EncoderFn)(constQString&amp;fileName)</div>
<li><div class="fn">typedef<b>QString</b>(*DecoderFn)(constQCString&amp;localfileName)</div>
<li><div class="fn">bool<a href="#900285"><b>exists</b></a>()const</div>
<li><div class="fn">bool<a href="#31dd61"><b>remove</b></a>()</div>
<li><div class="fn">virtualbool<a href="#84dd8e"><b>open</b></a>(int)</div>
<li><div class="fn">bool<a href="#8987f7"><b>open</b></a>(int, FILE*)</div>
<li><div class="fn">bool<a href="#255995"><b>open</b></a>(int, int)</div>
<li><div class="fn">virtualvoid<a href="#64e640"><b>close</b></a>()</div>
<li><div class="fn">virtualvoid<a href="#cb0092"><b>flush</b></a>()</div>
<li><div class="fn">virtualuint<a href="#1e3b5e"><b>size</b></a>()const</div>
<li><div class="fn">virtualint<a href="#8218c0"><b>at</b></a>()const</div>
<li><div class="fn">virtualbool<a href="#858d0b"><b>at</b></a>(int)</div>
<li><div class="fn">virtualbool<a href="#b08f02"><b>atEnd</b></a>()const</div>
<li><div class="fn">virtualint<a href="#8c8ccc"><b>readBlock</b></a>(char*data, uintlen)</div>
<li><div class="fn">virtualint<a href="#0a06c2"><b>readLine</b></a>(char*data, uintmaxlen)</div>
<li><div class="fn">int<a href="#1484a1"><b>readLine</b></a>(QString&amp;, uintmaxlen)</div>
<li><div class="fn">virtualint<a href="#596f05"><b>getch</b></a>()</div>
<li><div class="fn">virtualint<a href="#d70b87"><b>putch</b></a>(int)</div>
<li><div class="fn">virtualint<a href="#471cf3"><b>ungetch</b></a>(int)</div>
<li><div class="fn">int<a href="#f08f8f"><b>handle</b></a>()const</div>
</ul>
<h2>Static Public Members</h2>
<ul>
<li><div class="fn">QCString<a href="#6d63a6"><b>encodeName</b></a>(constQString&amp;fileName)</div>
<li><div class="fn">QString<a href="#21d9d1"><b>decodeName</b></a>(constQCString&amp;localFileName)</div>
<li><div class="fn">void<a href="#a34c1e"><b>setEncodingFunction</b></a>(EncoderFn)</div>
<li><div class="fn">void<a href="#53778b"><b>setDecodingFunction</b></a>(DecoderFn)</div>
<li><div class="fn">bool<a href="#b8dbf0"><b>exists</b></a>(constQString&amp;fileName)</div>
<li><div class="fn">bool<a href="#56e980"><b>remove</b></a>(constQString&amp;fileName)</div>
</ul>
<hr><h2><a name="details"></a>Detailed Description</h2>
The QFile class is an I/O device that operates on files.
<p>
QFile is an I/O device for reading and writing binary and text files. A
QFile may be used by itself (readBlock and writeBlock) or by more
conveniently using <a href="qdatastream.html">QDataStream</a> or <a href="qtextstream.html">QTextStream</a>.
<p>Here is a code fragment that uses QTextStream to read a text
file line by line. It prints each line with a line number.
<pre>    <a href="qfile.html">QFile</a> f("file.txt");
    if ( f.<a href="#255995">open</a>(IO_ReadOnly) ) {    // file opened successfully
        <a href="qtextstream.html">QTextStream</a> t( &amp;f );        // use a text stream
        <a href="qstring.html">QString</a> s;
        int n = 1;
        while ( !t.<a href="qtextstream.html#bb145b">eof</a>() ) {        // until end of file...
            s = t.<a href="qtextstream.html#ae4af4">readLine</a>();       // line of text excluding '\n'
            printf( "%3d: %s\n", n++, (const char *)s );
        }
        f.<a href="#64e640">close</a>();
    }
</pre>
<p>The <a href="qfileinfo.html">QFileInfo</a> class holds detailed information about a file, such as
access permissions, file dates and file types.
<p>The <a href="qdir.html">QDir</a> class manages directories and lists of file names.
<p>See also  <a href="qdatastream.html">QDataStream</a> and <a href="qtextstream.html">QTextStream</a>.
<p>Examples:
 <a href="xml-tagreader-tagreader-cpp.html#QFile">xml/tagreader/tagreader.cpp</a>
 <a href="xml-tagreader-with-features-tagreader-cpp.html#QFile">xml/tagreader-with-features/tagreader.cpp</a>

<hr><h2>Member Function Documentation</h2>
<h3 class="fn"><a name="b097df"></a>QFile::QFile()</h3>
<p>Constructs a QFile with no name.
<h3 class="fn"><a name="9f0c84"></a>QFile::QFile(const<a href="qstring.html">QString</a>&amp;name)</h3>
<p>Constructs a QFile with a file name <em>name.</em>
<p>See also  <a href="#f0c76b">setName</a>().
<h3 class="fn"><a name="17ae38"></a>QFile::~QFile()</h3>
<p>Destructs a QFile.  Calls <a href="#64e640">close</a>().
<h3 class="fn">bool<a name="858d0b"></a>QFile::at(intpos) <code>[virtual]</code></h3>
<p>Sets the file index to <em>pos.</em> Returns TRUE if successful, otherwise FALSE.
<p>Example:
<pre>    <a href="qfile.html">QFile</a> f( "data.bin" );
    f.<a href="#255995">open</a>( IO_ReadOnly );                      // index set to 0
    f.<a href="#8218c0">at</a>( 100 );                                // set index to 100
    f.<a href="#8218c0">at</a>( f.<a href="#8218c0">at</a>()+50 );                          // set index to 150
    f.<a href="#8218c0">at</a>( f.<a href="#1e3b5e">size</a>()-80 );                        // set index to 80 before EOF
    f.<a href="#64e640">close</a>();
</pre>
<p><b>Warning:</b> The result is undefined if the file was <a href="#255995">opened</a>
using the <code>IO_Append</code> specifier.
<p>See also  <a href="#1e3b5e">size</a>() and <a href="#255995">open</a>().
<p>Reimplemented from <a href="qiodevice.html#90fb01">QIODevice.</a>
<h3 class="fn">int<a name="8218c0"></a>QFile::at()const <code>[virtual]</code></h3>
<p>Returns the file index.
<p>See also  <a href="#1e3b5e">size</a>().
<p>Reimplemented from <a href="qiodevice.html#a8b90e">QIODevice.</a>
<h3 class="fn">bool<a name="b08f02"></a>QFile::atEnd()const <code>[virtual]</code></h3>
<p>Returns TRUE if the end of file has been reached, otherwise FALSE.
<p>See also  <a href="#1e3b5e">size</a>().
<p>Reimplemented from <a href="qiodevice.html#d51a01">QIODevice.</a>
<h3 class="fn">void<a name="64e640"></a>QFile::close() <code>[virtual]</code></h3>
<p>Closes an open file.
<p>The file is not closed if it was opened with an existing file handle.
If the existing file handle is a <code>FILE*,</code> the file is flushed.
If the existing file handle is an <code>int</code> file descriptor, nothing
is done to the file.
<p>Some "write-behind" filesystems may report an unspecified error on
closing the file. These errors only indicate that something may
have gone wrong since the previous <a href="#255995">open</a>(). In such a case <a href="qiodevice.html#494f6f">status</a>()
reports IO_UnspecifiedError after close(), otherwise IO_Ok.
<p>See also  <a href="#255995">open</a>() and <a href="#cb0092">flush</a>().
<p>Reimplemented from <a href="qiodevice.html#50fcfd">QIODevice.</a>
<h3 class="fn"><a href="qstring.html">QString</a><a name="21d9d1"></a>QFile::decodeName(const<a href="qcstring.html">QCString</a>&amp;localFileName) <code>[static]</code></h3>
<p>This does the reverse of <a href="#6d63a6">QFile::encodeName</a>().
<p>See also  <a href="#53778b">setDecodingFunction</a>().
<h3 class="fn"><a href="qcstring.html">QCString</a><a name="6d63a6"></a>QFile::encodeName(const<a href="qstring.html">QString</a>&amp;fileName) <code>[static]</code></h3>
<p>When you use QFile, <a href="qfileinfo.html">QFileInfo</a>, and <a href="qdir.html">QDir</a> to access the filesystem
with Qt, you can use Unicode filenames.  On Unix, these filenames
are converted to an 8-bit encoding.  If you want to do your own
file I/O on Unix, you should convert the filename using this
function.  On Windows NT, Unicode filenames are supported directly
in the filesystem and this function should be avoided. On Windows 95,
non-Latin1 locales are not supported at this time.
<p>By default, this function converts to the local 8-bit encoding
determined by the user's locale.  This is sufficient for
filenames that the user chooses.  Filenames hard-coded into the
application should only use 7-bit ASCII filename characters.
<p>The conversion scheme can be changed using <a href="#a34c1e">setEncodingFunction</a>().
This might be useful if you wish to give the user an option to
store in filenames in UTF-8, etc., but beware that such filenames
would probably then be unrecognizable when seen by other programs.
<p>See also  <a href="#21d9d1">decodeName</a>().
<h3 class="fn">bool<a name="900285"></a>QFile::exists()const</h3>
<p>Returns TRUE if this file exists, otherwise FALSE.
<p>See also  <a href="#f6ec78">name</a>().
<h3 class="fn">bool<a name="b8dbf0"></a>QFile::exists(const<a href="qstring.html">QString</a>&amp;fileName) <code>[static]</code></h3>
<p>Returns TRUE if the file given by <em>fileName</em> exists, otherwise FALSE.
<h3 class="fn">void<a name="cb0092"></a>QFile::flush() <code>[virtual]</code></h3>
<p>Flushes the file buffer to the disk.
<p><a href="#64e640">close</a>() also flushes the file buffer.
<p>Reimplemented from <a href="qiodevice.html#dfd9f0">QIODevice.</a>
<h3 class="fn">int<a name="596f05"></a>QFile::getch() <code>[virtual]</code></h3>
<p>Reads a single byte/character from the file.
<p>Returns the byte/character read, or -1 if the end of the file has been
reached.
<p>See also  <a href="#d70b87">putch</a>() and <a href="#471cf3">ungetch</a>().
<p>Reimplemented from <a href="qiodevice.html#09409b">QIODevice.</a>
<h3 class="fn">int<a name="f08f8f"></a>QFile::handle()const</h3>
<p>Returns the file handle of the file.
<p>This is a small positive integer, suitable for use with C library
functions such as fdopen() and fcntl(), as well as with <a href="qsocketnotifier.html">QSocketNotifier</a>.
<p>If the file is not open or there is an error, handle() returns -1.
<p>See also  <a href="qsocketnotifier.html">QSocketNotifier</a>.
<h3 class="fn"><a href="qstring.html">QString</a><a name="f6ec78"></a>QFile::name()const</h3>
<p>Returns the name set by <a href="#f0c76b">setName</a>().
<p>See also  <a href="#f0c76b">setName</a>() and <a href="qfileinfo.html#a9e3d2">QFileInfo::fileName</a>().
<h3 class="fn">bool<a name="84dd8e"></a>QFile::open(intm) <code>[virtual]</code></h3>
<p>Opens the file specified by the file name currently set, using the mode <em>m.</em>
Returns TRUE if successful, otherwise FALSE.
<p>The mode parameter <em>m</em> must be a combination of the following flags:
<ul>
<li><code>IO_Raw</code> specified raw (non-buffered) file access.
<li><code>IO_ReadOnly</code> opens the file in read-only mode.
<li><code>IO_WriteOnly</code> opens the file in write-only mode (and truncates).
<li><code>IO_ReadWrite</code> opens the file in read/write mode, equivalent to
<code>(IO_ReadOnly|IO_WriteOnly).</code>
<li><code>IO_Append</code> opens the file in append mode. This mode is very useful
when you want to write something to a log file. The file index is set to
the end of the file. Note that the result is undefined if you position the
file index manually using <a href="#8218c0">at</a>() in append mode.
<li><code>IO_Truncate</code> truncates the file.
<li><code>IO_Translate</code> enables carriage returns and linefeed translation
for text files under MS-DOS, Windows and OS/2.
</ul>
<p>The raw access mode is best when I/O is block-operated using 4kB block size
or greater. Buffered access works better when reading small portions of
data at a time.
<p><strong>Important:</strong> When working with buffered files, data may
not be written to the file at once. Call <a href="#cb0092">flush</a>
to make sure the data is really written.<p><b>Warning:</b> We have experienced problems with some C libraries when a buffered
file is opened for both reading and writing. If a read operation takes place
immediately after a write operation, the read buffer contains garbage data.
Worse, the same garbage is written to the file. Calling <a href="#cb0092">flush</a>() before
<a href="#8c8ccc">readBlock</a>() solved this problem.
<p>If the file does not exist and <code>IO_WriteOnly</code> or <code>IO_ReadWrite</code> is
specified, it is created.
<p>Example:
<pre>    <a href="qfile.html">QFile</a> f1( "/tmp/data.bin" );
    <a href="qfile.html">QFile</a> f2( "readme.txt" );
    f1.<a href="#255995">open</a>( IO_Raw | IO_ReadWrite | IO_Append );
    f2.<a href="#255995">open</a>( IO_ReadOnly | IO_Translate );
</pre>
<p>See also  <a href="#f6ec78">name</a>(), <a href="#64e640">close</a>(), <a href="qiodevice.html#1bc7b0">isOpen</a>() and <a href="#cb0092">flush</a>().
<p>Reimplemented from <a href="qiodevice.html#756b18">QIODevice.</a>
<h3 class="fn">bool<a name="8987f7"></a>QFile::open(intm, FILE*f)</h3>
<p>Opens a file in the mode <em>m</em> using an existing file handle <em>f.</em>
Returns TRUE if successful, otherwise FALSE.
<p>Example:
<pre>    #include &lt;stdio.h&gt;

    void printError( const char* msg )
    {
        <a href="qfile.html">QFile</a> f;
        f.<a href="#255995">open</a>( IO_WriteOnly, stderr );
        f.<a href="#a44b6a">writeBlock</a>( msg, qstrlen(msg) );      // write to stderr
        f.<a href="#64e640">close</a>();
    }
</pre>
<p>When a QFile is opened using this function, <a href="#64e640">close</a>() does not actually
close the file, only flushes it.<p><b>Warning:</b> If <em>f</em> is <code>stdin, stdout, stderr,</code> you may not
be able to seek.  See <a href="qiodevice.html#d264a5">QIODevice::isSequentialAccess</a>() for more
information.
<p>See also  <a href="#64e640">close</a>().
<h3 class="fn">bool<a name="255995"></a>QFile::open(intm, intf)</h3>
<p>Opens a file in the mode <em>m</em> using an existing file descriptor <em>f.</em>
Returns TRUE if successful, otherwise FALSE.
<p>When a QFile is opened using this function, <a href="#64e640">close</a>() does not actually
close the file.<p><b>Warning:</b> If <em>f</em> is one of 0 (stdin), 1 (stdout) or 2 (stderr), you may not
be able to seek. <a href="#1e3b5e">size</a>() is set to <code>INT_MAX</code> (in limits.h).
<p>See also  <a href="#64e640">close</a>().
<h3 class="fn">int<a name="d70b87"></a>QFile::putch(intch) <code>[virtual]</code></h3>
<p>Writes the character <em>ch</em> to the file.
<p>Returns <em>ch,</em> or -1 if some error occurred.
<p>See also  <a href="#596f05">getch</a>() and <a href="#471cf3">ungetch</a>().
<p>Reimplemented from <a href="qiodevice.html#71cd12">QIODevice.</a>
<h3 class="fn">int<a name="8c8ccc"></a>QFile::readBlock(char*p, uintlen) <code>[virtual]</code></h3>
<p>Reads at most <em>len</em> bytes from the file into <em>p</em> and returns the
number of bytes actually read.
<p>Returns -1 if a serious error occurred.<p><b>Warning:</b> We have experienced problems with some C libraries when a buffered
file is opened for both reading and writing. If a read operation takes place
immediately after a write operation, the read buffer contains garbage data.
Worse, the same garbage is written to the file. Calling <a href="#cb0092">flush</a>() before
readBlock() solved this problem.
<p>See also  <a href="#a44b6a">writeBlock</a>().
<p>Reimplemented from <a href="qiodevice.html#c12e6e">QIODevice.</a>
<h3 class="fn">int<a name="1484a1"></a>QFile::readLine(<a href="qstring.html">QString</a>&amp;s, uintmaxlen)</h3>
<p>Reads a line of text.
<p>Reads bytes from the file until end-of-line is reached, or up to <em>maxlen</em> bytes, and returns the number of bytes read, or -1 in case of
error.  The terminating newline is not stripped.
<p>This function is efficient only for buffered files.  Avoid
<a href="#0a06c2">readLine</a>() for files that have been opened with the <code>IO_Raw</code>
flag.
<p>Note that the string is read as plain Latin1 bytes, not Unicode.
<p>See also  <a href="#8c8ccc">readBlock</a>() and <a href="qtextstream.html#ae4af4">QTextStream::readLine</a>().
<h3 class="fn">int<a name="0a06c2"></a>QFile::readLine(char*p, uintmaxlen) <code>[virtual]</code></h3>
<p>Reads a line of text.
<p>Reads bytes from the file until end-of-line is reached, or up to <em>maxlen</em> bytes, and returns the number of bytes read, or -1 in case of
error.  The terminating newline is not stripped.
<p>This function is efficient only for buffered files.  Avoid
readLine() for files that have been opened with the <code>IO_Raw</code>
flag.
<p>See also  <a href="#8c8ccc">readBlock</a>() and <a href="qtextstream.html#ae4af4">QTextStream::readLine</a>().
<p>Reimplemented from <a href="qiodevice.html#0b6051">QIODevice.</a>
<h3 class="fn">bool<a name="31dd61"></a>QFile::remove()</h3>
<p>Removes the file specified by the file name currently set.
Returns TRUE if successful, otherwise FALSE.
<p>The file is closed before it is removed.
<h3 class="fn">bool<a name="56e980"></a>QFile::remove(const<a href="qstring.html">QString</a>&amp;fileName) <code>[static]</code></h3>
<p>Removes the file <em>fileName.</em>
Returns TRUE if successful, otherwise FALSE.
<h3 class="fn">void<a name="53778b"></a>QFile::setDecodingFunction(<a href="qfile.html#DecoderFn">DecoderFn</a>f) <code>[static]</code></h3>
<p>Sets the function for decoding 8-bit filenames.
The default uses the locale-specific 8-bit encoding.
<p>See also  <a href="#6d63a6">encodeName</a>() and <a href="#21d9d1">decodeName</a>().
<h3 class="fn">void<a name="a34c1e"></a>QFile::setEncodingFunction(<a href="qfile.html#EncoderFn">EncoderFn</a>f) <code>[static]</code></h3>
<p>Sets the function for encoding Unicode filenames.
The default encodes in the locale-specific 8-bit encoding.
<p>See also  <a href="#6d63a6">encodeName</a>().
<h3 class="fn">void<a name="f0c76b"></a>QFile::setName(const<a href="qstring.html">QString</a>&amp;name)</h3>
<p>Sets the name of the file. The name can include an absolute directory
path or it can be a name or a path relative to the current directory.
<p>Do not call this function if the file has already been opened.
<p>Note that if the name is relative QFile does not associate it with the
current directory.  If you change directory before calling <a href="#255995">open</a>(), open
uses the new current directory.
<p>Example:
<pre>     <a href="qfile.html">QFile</a> f;
     <a href="qdir.html#5faf24">QDir::setCurrent</a>( "/tmp" );
     f.<a href="#f0c76b">setName</a>( "readme.txt" );
     <a href="qdir.html#5faf24">QDir::setCurrent</a>( "/home" );
     f.<a href="#255995">open</a>( IO_ReadOnly );        // opens "/home/readme.txt" under UNIX
</pre>
<p>Also note that the directory separator '/' works for all operating
systems supported by Qt.
<p>See also  <a href="#f6ec78">name</a>(), <a href="qfileinfo.html">QFileInfo</a> and <a href="qdir.html">QDir</a>.
<h3 class="fn">uint<a name="1e3b5e"></a>QFile::size()const <code>[virtual]</code></h3>
<p>Returns the file size.
<p>See also  <a href="#8218c0">at</a>().
<p>Reimplemented from <a href="qiodevice.html#8ddedd">QIODevice.</a>
<h3 class="fn">int<a name="471cf3"></a>QFile::ungetch(intch) <code>[virtual]</code></h3>
<p>Puts the character <em>ch</em> back into the file and decrements the index if it
is not zero.
<p>This function is normally called to "undo" a <a href="#596f05">getch</a>() operation.
<p>Returns <em>ch,</em> or -1 if some error occurred.
<p>See also  <a href="#596f05">getch</a>() and <a href="#d70b87">putch</a>().
<p>Reimplemented from <a href="qiodevice.html#05a43c">QIODevice.</a>
<h3 class="fn">int<a name="ac9325"></a>QFile::writeBlock(const<a href="qbytearray.html">QByteArray</a>&amp;data)</h3>
<p>Reimplemented for internal reasons; the API is not affected.
<h3 class="fn">int<a name="a44b6a"></a>QFile::writeBlock(constchar*p, uintlen) <code>[virtual]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Writes <em>len</em> bytes from <em>p</em> to the file and returns the number of
bytes actually written.
<p>Returns -1 if a serious error occurred.<p><b>Warning:</b> When working with buffered files, data may not be written
to the file at once. Call <a href="#cb0092">flush</a>() to make sure the data is really
written.
<p>See also  <a href="#8c8ccc">readBlock</a>().
<p>Reimplemented from <a href="qiodevice.html#924d2f">QIODevice.</a>
<hr><p>
Search the documentation, FAQ, qt-interest archive and more (uses
<a href="http://www.trolltech.com">www.trolltech.com</a>):<br>
<form method=post action="http://www.trolltech.com/search.cgi">
<input type=hidden name="version" value="2.3.2"><nobr>
<input size="50" name="search"><input type=submit value="Search">
</nobr></form><hr><p>
This file is part of the <a href="index.html">Qt toolkit</a>,
copyright &copy; 1995-2001
<a href="http://www.trolltech.com">Trolltech</a>, all rights reserved.<p><address><hr><div align="center">
<table width="100%" cellspacing="0" border="0"><tr>
<td>Copyright  2001 Trolltech<td><a href="http://www.trolltech.com/trademarks.html">Trademarks</a>
<td align="right"><div align="right">Qt version 2.3.2</div>
</table></div></address></body></html>