summaryrefslogtreecommitdiffstats
path: root/doc/man/man3/tqtextstream.3qt
blob: 41682ee1e8bdb0d29d2bb56d7ea8714b2b14a2d2 (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
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
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
'\" t
.TH TQTextStream 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*-
.\" Copyright 1992-2007 Trolltech ASA.  All rights reserved.  See the
.\" license file included in the distribution for a complete license
.\" statement.
.\"
.ad l
.nh
.SH NAME
TQTextStream \- Basic functions for reading and writing text using a TQIODevice
.SH SYNOPSIS
All the functions in this class are reentrant when TQt is built with thread support.</p>
.PP
\fC#include <tqtextstream.h>\fR
.PP
Inherited by TQTextIStream and TQTextOStream.
.PP
.SS "Public Members"
.in +1c
.ti -1c
.BI "enum \fBEncoding\fR { Locale, Latin1, Unicode, UnicodeNetworkOrder, UnicodeReverse, RawUnicode, UnicodeUTF8 }"
.br
.ti -1c
.BI "void \fBsetEncoding\fR ( Encoding e )"
.br
.ti -1c
.BI "void \fBsetCodec\fR ( TQTextCodec * codec )"
.br
.ti -1c
.BI "TQTextCodec * \fBcodec\fR ()"
.br
.ti -1c
.BI "\fBTQTextStream\fR ()"
.br
.ti -1c
.BI "\fBTQTextStream\fR ( TQIODevice * iod )"
.br
.ti -1c
.BI "\fBTQTextStream\fR ( TQString * str, int filemode )"
.br
.ti -1c
.BI "TQTextStream ( TQString & str, int filemode )  \fI(obsolete)\fR"
.br
.ti -1c
.BI "\fBTQTextStream\fR ( TQByteArray a, int mode )"
.br
.ti -1c
.BI "\fBTQTextStream\fR ( FILE * fh, int mode )"
.br
.ti -1c
.BI "virtual \fB~TQTextStream\fR ()"
.br
.ti -1c
.BI "TQIODevice * \fBdevice\fR () const"
.br
.ti -1c
.BI "void \fBsetDevice\fR ( TQIODevice * iod )"
.br
.ti -1c
.BI "void \fBunsetDevice\fR ()"
.br
.ti -1c
.BI "bool \fBatEnd\fR () const"
.br
.ti -1c
.BI "bool eof () const  \fI(obsolete)\fR"
.br
.ti -1c
.BI "TQTextStream & \fBoperator>>\fR ( TQChar & c )"
.br
.ti -1c
.BI "TQTextStream & \fBoperator>>\fR ( char & c )"
.br
.ti -1c
.BI "TQTextStream & \fBoperator>>\fR ( signed short & i )"
.br
.ti -1c
.BI "TQTextStream & \fBoperator>>\fR ( unsigned short & i )"
.br
.ti -1c
.BI "TQTextStream & \fBoperator>>\fR ( signed int & i )"
.br
.ti -1c
.BI "TQTextStream & \fBoperator>>\fR ( unsigned int & i )"
.br
.ti -1c
.BI "TQTextStream & \fBoperator>>\fR ( signed long & i )"
.br
.ti -1c
.BI "TQTextStream & \fBoperator>>\fR ( unsigned long & i )"
.br
.ti -1c
.BI "TQTextStream & \fBoperator>>\fR ( float & f )"
.br
.ti -1c
.BI "TQTextStream & \fBoperator>>\fR ( double & f )"
.br
.ti -1c
.BI "TQTextStream & \fBoperator>>\fR ( char * s )"
.br
.ti -1c
.BI "TQTextStream & \fBoperator>>\fR ( TQString & str )"
.br
.ti -1c
.BI "TQTextStream & \fBoperator>>\fR ( TQCString & str )"
.br
.ti -1c
.BI "TQTextStream & \fBoperator<<\fR ( TQChar c )"
.br
.ti -1c
.BI "TQTextStream & \fBoperator<<\fR ( char c )"
.br
.ti -1c
.BI "TQTextStream & \fBoperator<<\fR ( signed short i )"
.br
.ti -1c
.BI "TQTextStream & \fBoperator<<\fR ( unsigned short i )"
.br
.ti -1c
.BI "TQTextStream & \fBoperator<<\fR ( signed int i )"
.br
.ti -1c
.BI "TQTextStream & \fBoperator<<\fR ( unsigned int i )"
.br
.ti -1c
.BI "TQTextStream & \fBoperator<<\fR ( signed long i )"
.br
.ti -1c
.BI "TQTextStream & \fBoperator<<\fR ( unsigned long i )"
.br
.ti -1c
.BI "TQTextStream & \fBoperator<<\fR ( float f )"
.br
.ti -1c
.BI "TQTextStream & \fBoperator<<\fR ( double f )"
.br
.ti -1c
.BI "TQTextStream & \fBoperator<<\fR ( const char * s )"
.br
.ti -1c
.BI "TQTextStream & \fBoperator<<\fR ( const TQString & s )"
.br
.ti -1c
.BI "TQTextStream & \fBoperator<<\fR ( const TQCString & s )"
.br
.ti -1c
.BI "TQTextStream & \fBoperator<<\fR ( void * ptr )"
.br
.ti -1c
.BI "TQTextStream & \fBreadRawBytes\fR ( char * s, uint len )"
.br
.ti -1c
.BI "TQTextStream & \fBwriteRawBytes\fR ( const char * s, uint len )"
.br
.ti -1c
.BI "TQString \fBreadLine\fR ()"
.br
.ti -1c
.BI "TQString \fBread\fR ()"
.br
.ti -1c
.BI "void \fBskipWhiteSpace\fR ()"
.br
.ti -1c
.BI "int \fBflags\fR () const"
.br
.ti -1c
.BI "int \fBflags\fR ( int f )"
.br
.ti -1c
.BI "int \fBsetf\fR ( int bits )"
.br
.ti -1c
.BI "int \fBsetf\fR ( int bits, int mask )"
.br
.ti -1c
.BI "int \fBunsetf\fR ( int bits )"
.br
.ti -1c
.BI "void \fBreset\fR ()"
.br
.ti -1c
.BI "int \fBwidth\fR () const"
.br
.ti -1c
.BI "int \fBwidth\fR ( int w )"
.br
.ti -1c
.BI "int \fBfill\fR () const"
.br
.ti -1c
.BI "int \fBfill\fR ( int f )"
.br
.ti -1c
.BI "int \fBprecision\fR () const"
.br
.ti -1c
.BI "int \fBprecision\fR ( int p )"
.br
.in -1c
.SH DESCRIPTION
The TQTextStream class provides basic functions for reading and writing text using a TQIODevice.
.PP
The text stream class has a functional interface that is very similar to that of the standard C++ iostream class.
.PP
Qt provides several global functions similar to the ones in iostream: <center>.nf
.TS
l - l. Function Meaning bin sets the TQTextStream to read/write binary numbers oct sets the TQTextStream to read/write octal numbers dec sets the TQTextStream to read/write decimal numbers hex sets the TQTextStream to read/write hexadecimal numbers endl forces a line break flush forces the TQIODevice to flush any buffered data ws eats any available whitespace (on input) reset resets the TQTextStream to its default mode (see reset()) qSetW(int) sets the field width to the given argument qSetFill(int) sets the fill character to the given argument qSetPrecision(int)
.TE
.fi
</center>
.PP
\fBWarning:\fR By default TQTextStream will automatically detect whether integers in the stream are in decimal, octal, hexadecimal or binary format when reading from the stream. In particular, a leading '0' signifies octal, i.e. the sequence "0100" will be interpreted as 64.
.PP
The TQTextStream class reads and writes text; it is not appropriate for dealing with binary data (but TQDataStream is).
.PP
By default, output of Unicode text (i.e. TQString) is done using the local 8-bit encoding. This can be changed using the setEncoding() method. For input, the TQTextStream will auto-detect standard Unicode "byte order marked" text files; otherwise the local 8-bit encoding is used.
.PP
The TQIODevice is set in the constructor, or later using setDevice(). If the end of the input is reached atEnd() returns TRUE. Data can be read into variables of the appropriate type using the operator>>() overloads, or read in its entirety into a single string using read(), or read a line at a time using readLine(). Whitespace can be skipped over using skipWhiteSpace(). You can set flags for the stream using flags() or setf(). The stream also supports width(), precision() and fill(); use reset() to reset the defaults.
.PP
See also TQDataStream, Input/Output and Networking, and Text Related Classes.
.SS "Member Type Documentation"
.SH "TQTextStream::Encoding"
.TP
\fCTQTextStream::Locale\fR
.TP
\fCTQTextStream::Latin1\fR
.TP
\fCTQTextStream::Unicode\fR
.TP
\fCTQTextStream::UnicodeNetworkOrder\fR
.TP
\fCTQTextStream::UnicodeReverse\fR
.TP
\fCTQTextStream::RawUnicode\fR
.TP
\fCTQTextStream::UnicodeUTF8\fR
.PP
See setEncoding() for an explanation of the encodings.
.SH MEMBER FUNCTION DOCUMENTATION
.SH "TQTextStream::TQTextStream ()"
Constructs a data stream that has no IO device.
.SH "TQTextStream::TQTextStream ( TQIODevice * iod )"
Constructs a text stream that uses the IO device \fIiod\fR.
.SH "TQTextStream::TQTextStream ( TQString * str, int filemode )"
Constructs a text stream that operates on the Unicode TQString, \fIstr\fR, through an internal device. The \fIfilemode\fR argument is passed to the device's open() function; see TQIODevice::mode().
.PP
If you set an encoding or codec with setEncoding() or setCodec(), this setting is ignored for text streams that operate on TQString.
.PP
Example:
.PP
.nf
.br
    TQString str;
.br
    TQTextStream ts( &str, IO_WriteOnly );
.br
    ts << "pi = " << 3.14; // str == "pi = 3.14"
.br
.fi
.PP
Writing data to the text stream will modify the contents of the string. The string will be expanded when data is written beyond the end of the string. Note that the string will not be truncated:
.PP
.nf
.br
    TQString str = "pi = 3.14";
.br
    TQTextStream ts( &str, IO_WriteOnly );
.br
    ts <<  "2+2 = " << 2+2; // str == "2+2 = 414"
.br
.fi
.PP
Note that because TQString is Unicode, you should not use readRawBytes() or writeRawBytes() on such a stream.
.SH "TQTextStream::TQTextStream ( TQString & str, int filemode )"
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
.PP
This constructor is equivalent to the constructor taking a TQString* parameter.
.SH "TQTextStream::TQTextStream ( TQByteArray a, int mode )"
Constructs a text stream that operates on the byte array, \fIa\fR, through an internal TQBuffer device. The \fImode\fR argument is passed to the device's open() function; see TQIODevice::mode().
.PP
Example:
.PP
.nf
.br
    TQByteArray array;
.br
    TQTextStream ts( array, IO_WriteOnly );
.br
    ts << "pi = " << 3.14 << '\\0'; // array == "pi = 3.14"
.br
.fi
.PP
Writing data to the text stream will modify the contents of the array. The array will be expanded when data is written beyond the end of the string.
.PP
Same example, using a TQBuffer:
.PP
.nf
.br
    TQByteArray array;
.br
    TQBuffer buf( array );
.br
    buf.open( IO_WriteOnly );
.br
    TQTextStream ts( &buf );
.br
    ts << "pi = " << 3.14 << '\\0'; // array == "pi = 3.14"
.br
    buf.close();
.br
.fi
.SH "TQTextStream::TQTextStream ( FILE * fh, int mode )"
Constructs a text stream that operates on an existing file handle \fIfh\fR through an internal TQFile device. The \fImode\fR argument is passed to the device's open() function; see TQIODevice::mode().
.PP
Note that if you create a TQTextStream \fCcout\fR or another name that is also used for another variable of a different type, some linkers may confuse the two variables, which will often cause crashes.
.SH "TQTextStream::~TQTextStream ()\fC [virtual]\fR"
Destroys the text stream.
.PP
The destructor does not affect the current IO device.
.SH "bool TQTextStream::atEnd () const"
Returns TRUE if the IO device has reached the end position (end of the stream or file) or if there is no IO device set; otherwise returns FALSE.
.PP
See also TQIODevice::atEnd().
.PP
Examples:
.)l addressbook/centralwidget.cpp and grapher/grapher.cpp.
.SH "TQTextCodec * TQTextStream::codec ()"
Returns the codec actually used for this stream.
.PP
If Unicode is automatically detected in input, a codec with name() "ISO-10646-UCS-2" is returned.
.PP
See also setCodec().
.SH "TQIODevice * TQTextStream::device () const"
Returns the IO device currently set.
.PP
See also setDevice() and unsetDevice().
.SH "bool TQTextStream::eof () const"
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
.PP
This function has been renamed to atEnd().
.PP
See also TQIODevice::atEnd().
.PP
Example: chart/chartform_files.cpp.
.SH "int TQTextStream::fill () const"
Returns the fill character. The default value is ' ' (space).
.SH "int TQTextStream::fill ( int f )"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Sets the fill character to \fIf\fR. Returns the previous fill character.
.SH "int TQTextStream::flags () const"
Returns the current stream flags. The default value is 0.
.PP
<center>.nf
.TS
l
-
l.
Flag	Meaning
	Not currently used; whitespace always skipped
	Numeric fields are left-aligned
	Not currently used (by default, numerics are right-aligned)
	Puts any padding spaces between +/- and value
	Output \fIand\fR input only in binary
	Output \fIand\fR input only in octal
	Output \fIand\fR input only in decimal
	Output \fIand\fR input only in hexadecimal
	Annotates numeric outputs with 0b, 0, or 0x if in
	Not currently used
	Uses 0B and 0X rather than 0b and 0x
	Shows + for positive numeric values
	Uses scientific notation for floating point values

.TE
.fi
</center>
.PP
Note that unless \fCbin\fR, \fCoct\fR, \fCdec\fR, or \fChex\fR is set, the input base is octal if the value starts with 0, hexadecimal if it starts with 0x, binary if it starts with 0b, and decimal otherwise.
.PP
See also setf() and unsetf().
.SH "int TQTextStream::flags ( int f )"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Sets the stream flags to \fIf\fR. Returns the previous stream flags.
.PP
See also setf() and unsetf().
.SH "TQTextStream & TQTextStream::operator<< ( TQChar c )"
Writes character \fCchar\fR to the stream and returns a reference to the stream.
.PP
The character \fIc\fR is assumed to be Latin1 encoded independent of the Encoding set for the TQTextStream.
.SH "TQTextStream & TQTextStream::operator<< ( char c )"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Writes character \fIc\fR to the stream and returns a reference to the stream.
.SH "TQTextStream & TQTextStream::operator<< ( signed short i )"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Writes a \fCshort\fR integer \fIi\fR to the stream and returns a reference to the stream.
.SH "TQTextStream & TQTextStream::operator<< ( unsigned short i )"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Writes an \fCunsigned\fR \fCshort\fR integer \fIi\fR to the stream and returns a reference to the stream.
.SH "TQTextStream & TQTextStream::operator<< ( signed int i )"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Writes an \fCint\fR \fIi\fR to the stream and returns a reference to the stream.
.SH "TQTextStream & TQTextStream::operator<< ( unsigned int i )"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Writes an \fCunsigned\fR \fCint\fR \fIi\fR to the stream and returns a reference to the stream.
.SH "TQTextStream & TQTextStream::operator<< ( signed long i )"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Writes a \fClong\fR \fCint\fR \fIi\fR to the stream and returns a reference to the stream.
.SH "TQTextStream & TQTextStream::operator<< ( unsigned long i )"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Writes an \fCunsigned\fR \fClong\fR \fCint\fR \fIi\fR to the stream and returns a reference to the stream.
.SH "TQTextStream & TQTextStream::operator<< ( float f )"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Writes a \fCfloat\fR \fIf\fR to the stream and returns a reference to the stream.
.SH "TQTextStream & TQTextStream::operator<< ( double f )"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Writes a \fCdouble\fR \fIf\fR to the stream and returns a reference to the stream.
.SH "TQTextStream & TQTextStream::operator<< ( const char * s )"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Writes a string to the stream and returns a reference to the stream.
.PP
The string \fIs\fR is assumed to be Latin1 encoded independent of the Encoding set for the TQTextStream.
.SH "TQTextStream & TQTextStream::operator<< ( const TQString & s )"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Writes \fIs\fR to the stream and returns a reference to the stream.
.SH "TQTextStream & TQTextStream::operator<< ( const TQCString & s )"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Writes \fIs\fR to the stream and returns a reference to the stream.
.PP
The string \fIs\fR is assumed to be Latin1 encoded independent of the Encoding set for the TQTextStream.
.SH "TQTextStream & TQTextStream::operator<< ( void * ptr )"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Writes a pointer to the stream and returns a reference to the stream.
.PP
The \fIptr\fR is output as an unsigned long hexadecimal integer.
.SH "TQTextStream & TQTextStream::operator>> ( TQChar & c )"
Reads a char \fIc\fR from the stream and returns a reference to the stream. Note that whitespace is \fInot\fR skipped.
.SH "TQTextStream & TQTextStream::operator>> ( char & c )"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Reads a char \fIc\fR from the stream and returns a reference to the stream. Note that whitespace is skipped.
.SH "TQTextStream & TQTextStream::operator>> ( signed short & i )"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Reads a signed \fCshort\fR integer \fIi\fR from the stream and returns a reference to the stream. See flags() for an explanation of the expected input format.
.SH "TQTextStream & TQTextStream::operator>> ( unsigned short & i )"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Reads an unsigned \fCshort\fR integer \fIi\fR from the stream and returns a reference to the stream. See flags() for an explanation of the expected input format.
.SH "TQTextStream & TQTextStream::operator>> ( signed int & i )"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Reads a signed \fCint\fR \fIi\fR from the stream and returns a reference to the stream. See flags() for an explanation of the expected input format.
.SH "TQTextStream & TQTextStream::operator>> ( unsigned int & i )"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Reads an unsigned \fCint\fR \fIi\fR from the stream and returns a reference to the stream. See flags() for an explanation of the expected input format.
.SH "TQTextStream & TQTextStream::operator>> ( signed long & i )"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Reads a signed \fClong\fR int \fIi\fR from the stream and returns a reference to the stream. See flags() for an explanation of the expected input format.
.SH "TQTextStream & TQTextStream::operator>> ( unsigned long & i )"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Reads an unsigned \fClong\fR int \fIi\fR from the stream and returns a reference to the stream. See flags() for an explanation of the expected input format.
.SH "TQTextStream & TQTextStream::operator>> ( float & f )"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Reads a \fCfloat\fR \fIf\fR from the stream and returns a reference to the stream. See flags() for an explanation of the expected input format.
.SH "TQTextStream & TQTextStream::operator>> ( double & f )"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Reads a \fCdouble\fR \fIf\fR from the stream and returns a reference to the stream. See flags() for an explanation of the expected input format.
.SH "TQTextStream & TQTextStream::operator>> ( char * s )"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Reads a "word" from the stream into \fIs\fR and returns a reference to the stream.
.PP
A word consists of characters for which isspace() returns FALSE.
.SH "TQTextStream & TQTextStream::operator>> ( TQString & str )"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Reads a "word" from the stream into \fIstr\fR and returns a reference to the stream.
.PP
A word consists of characters for which isspace() returns FALSE.
.SH "TQTextStream & TQTextStream::operator>> ( TQCString & str )"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Reads a "word" from the stream into \fIstr\fR and returns a reference to the stream.
.PP
A word consists of characters for which isspace() returns FALSE.
.SH "int TQTextStream::precision () const"
Returns the precision. The default value is 6.
.SH "int TQTextStream::precision ( int p )"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Sets the precision to \fIp\fR. Returns the previous precision setting.
.SH "TQString TQTextStream::read ()"
Reads the entire stream from the current position, and returns a string containing the text.
.PP
See also TQIODevice::readLine().
.PP
Examples:
.)l action/application.cpp, application/application.cpp, mdi/application.cpp, tqdir/tqdir.cpp, and qwerty/qwerty.cpp.
.SH "TQString TQTextStream::readLine ()"
Reads a line from the stream and returns a string containing the text.
.PP
The returned string does not contain any trailing newline or carriage return. Note that this is different from TQIODevice::readLine(), which does not strip the newline at the end of the line.
.PP
On EOF you will get a TQString that is null. On reading an empty line the returned TQString is empty but not null.
.PP
See also TQIODevice::readLine().
.PP
Examples:
.)l addressbook/centralwidget.cpp, chart/element.cpp, and network/clientserver/server/server.cpp.
.SH "TQTextStream & TQTextStream::readRawBytes ( char * s, uint len )"
Reads \fIlen\fR bytes from the stream into \fIs\fR and returns a reference to the stream.
.PP
The buffer \fIs\fR must be preallocated.
.PP
Note that no encoding is done by this function.
.PP
\fBWarning:\fR The behavior of this function is undefined unless the stream's encoding is set to Unicode or Latin1.
.PP
See also TQIODevice::readBlock().
.SH "void TQTextStream::reset ()"
Resets the text stream.
.TP
All flags are set to 0.
.TP
The field width is set to 0.
.TP
The fill character is set to ' ' (Space).
.TP
The precision is set to 6.
.PP
See also setf(), width(), fill(), and precision().
.SH "void TQTextStream::setCodec ( TQTextCodec * codec )"
Sets the codec for this stream to \fIcodec\fR. Will not try to autodetect Unicode.
.PP
Note that this function should be called before any data is read to/written from the stream.
.PP
See also setEncoding() and codec().
.PP
Example: qwerty/qwerty.cpp.
.SH "void TQTextStream::setDevice ( TQIODevice * iod )"
Sets the IO device to \fIiod\fR.
.PP
See also device() and unsetDevice().
.SH "void TQTextStream::setEncoding ( Encoding e )"
Sets the encoding of this stream to \fIe\fR, where \fIe\fR is one of the following values: <center>.nf
.TS
l - l. Encoding Meaning Locale Uses local file format (Latin1 if locale is not set), but autodetecting Unicode(utf16) on input. Unicode Uses Unicode(utf16) for input and output. Output will be written in the order most efficient for the current platform (i.e. the order used internally in TQString). UnicodeUTF8 Using Unicode(utf8) for input and output. If you use it for input it will autodetect utf16 and use it instead of utf8. Latin1 ISO-8859-1. Will not autodetect utf16. UnicodeNetworkOrder Uses network order Unicode(utf16) for input and output. Useful when reading Unicode data that does not start with the byte order marker. UnicodeReverse Uses reverse network order Unicode(utf16) for input and output. Useful when reading Unicode data that does not start with the byte order marker or when writing data that should be read by buggy Windows applications. RawUnicode
.TE
.fi
</center>
.PP
Locale and all Unicode encodings, except RawUnicode, will look at the first two bytes in an input stream to determine the byte order. The initial byte order marker will be stripped off before data is read.
.PP
Note that this function should be called before any data is read to or written from the stream.
.PP
See also setCodec().
.PP
Examples:
.)l addressbook/centralwidget.cpp, network/httpd/httpd.cpp, and qwerty/qwerty.cpp.
.SH "int TQTextStream::setf ( int bits )"
Sets the stream flag bits \fIbits\fR. Returns the previous stream flags.
.PP
Equivalent to \fCflags( flags() | bits )\fR.
.PP
See also unsetf().
.SH "int TQTextStream::setf ( int bits, int mask )"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Sets the stream flag bits \fIbits\fR with a bit mask \fImask\fR. Returns the previous stream flags.
.PP
Equivalent to \fCflags( (flags() & ~mask) | (bits & mask) )\fR.
.PP
See also unsetf().
.SH "void TQTextStream::skipWhiteSpace ()"
Positions the read pointer at the first non-whitespace character.
.SH "void TQTextStream::unsetDevice ()"
Unsets the IO device. Equivalent to setDevice( 0 ).
.PP
See also device() and setDevice().
.SH "int TQTextStream::unsetf ( int bits )"
Clears the stream flag bits \fIbits\fR. Returns the previous stream flags.
.PP
Equivalent to \fCflags( flags() & ~mask )\fR.
.PP
See also setf().
.SH "int TQTextStream::width () const"
Returns the field width. The default value is 0.
.SH "int TQTextStream::width ( int w )"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Sets the field width to \fIw\fR. Returns the previous field width.
.SH "TQTextStream & TQTextStream::writeRawBytes ( const char * s, uint len )"
Writes the \fIlen\fR bytes from \fIs\fR to the stream and returns a reference to the stream.
.PP
Note that no encoding is done by this function.
.PP
See also TQIODevice::writeBlock().

.SH "SEE ALSO"
.BR http://doc.trolltech.com/tqtextstream.html
.BR http://www.trolltech.com/faq/tech.html
.SH COPYRIGHT
Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com.  See the
license file included in the distribution for a complete license
statement.
.SH AUTHOR
Generated automatically from the source code.
.SH BUGS
If you find a bug in Qt, please report it as described in
.BR http://doc.trolltech.com/bughowto.html .
Good bug reports help us to help you. Thank you.
.P
The definitive TQt documentation is provided in HTML format; it is
located at $TQTDIR/doc/html and can be read using TQt Assistant or with
a web browser. This man page is provided as a convenience for those
users who prefer man pages, although this format is not officially
supported by Trolltech. 
.P
If you find errors in this manual page, please report them to
.BR [email protected] .
Please include the name of the manual page (tqtextstream.3qt) and the Qt
version (3.3.8).