1 % ----------------------------------------------------------------------------
3 % ----------------------------------------------------------------------------
4 \section{\class{wxTextInputStream
}}\label{wxtextinputstream
}
6 This class provides functions that read text datas using an input stream.
7 So, you can read
\it{text
} floats, integers.
9 The wxTextInputStream correctly reads text files (or streams) in DOS, Macintosh
10 and Unix formats and reports a single newline char as a line ending.
12 Operator >> is overloaded and you can use this class like a standard C++ iostream.
13 Note, however, that the arguments are the fixed size types wxUint32, wxInt32 etc
14 and on a typical
32-bit computer, none of these match to the "long" type (wxInt32
15 is defined as int on
32-bit architectures) so that you cannot use long. To avoid
16 problems (here and elsewhere), make use of the wxInt32, wxUint32, etc types.
20 wxFileInputStream input( "mytext.txt" );
21 wxTextInputStream text( input );
26 text >> i1; // read a
8 bit integer.
27 text >> i1 >> f2; // read a
8 bit integer followed by float.
28 text >> line; // read a text line
31 \wxheading{Include files
}
35 \latexignore{\rtfignore{\wxheading{Members
}}}
37 \membersection{wxTextInputStream::wxTextInputStream
}\label{wxtextinputstreamconstr
}
39 \func{}{wxTextInputStream
}{\param{wxInputStream\&
}{ stream
}}
41 Constructs a text stream object from an input stream. Only read methods will
44 \wxheading{Parameters
}
46 \docparam{stream
}{The input stream.
}
48 \membersection{wxTextInputStream::
\destruct{wxTextInputStream
}}
50 \func{}{\destruct{wxTextInputStream
}}{\void}
52 Destroys the wxTextInputStream object.
54 \membersection{wxTextInputStream::Read8
}
56 \func{wxUint8
}{Read8
}{\void}
58 Reads a single byte from the stream.
60 \membersection{wxTextInputStream::Read16
}
62 \func{wxUint16
}{Read16
}{\void}
64 Reads a
16 bit integer from the stream.
66 \membersection{wxTextInputStream::Read32
}
68 \func{wxUint16
}{Read32
}{\void}
70 Reads a
32 bit integer from the stream.
72 \membersection{wxTextInputStream::ReadDouble
}
74 \func{double
}{ReadDouble
}{\void}
76 Reads a double (IEEE encoded) from the stream.
78 \membersection{wxTextInputStream::ReadString
}
80 \func{wxString
}{wxTextInputStream::ReadString
}{\void}
82 Reads a line from the stream. A line is a string which ends with
83 $
\backslash$n or $
\backslash$r$
\backslash$n or $
\backslash$r.
85 % ----------------------------------------------------------------------------
87 % ----------------------------------------------------------------------------
89 \section{\class{wxTextOutputStream
}}\label{wxtextoutputstream
}
91 This class provides functions that write text datas using an output stream.
92 So, you can write
\it{text
} floats, integers.
96 wxFileOutputStream output( "mytext.txt" );
97 wxTextOutputStream text( output );
99 output << "This is a text line
\n";
104 The wxTextOutputStream writes text files (or streams) on DOS, Macintosh
105 and Unix in their native formats (concerning the line ending).
107 \latexignore{\rtfignore{\wxheading{Members
}}}
109 \membersection{wxTextOutputStream::wxTextOutputStream
}\label{wxdataoutputstreamconstr
}
111 \func{}{wxTextOutputStream
}{\param{wxOutputStream\&
}{ stream
}}
113 Constructs a text stream object from an output stream. Only write methods will
116 \wxheading{Parameters
}
118 \docparam{stream
}{The output stream.
}
120 \membersection{wxTextOutputStream::
\destruct{wxTextOutputStream
}}
122 \func{}{\destruct{wxTextOutputStream
}}{\void}
124 Destroys the wxTextOutputStream object.
126 \membersection{wxTextOutputStream::Write8
}
128 \func{void
}{wxTextOutputStream::Write8
}{{\param wxUint8
}{i8
}}
130 Writes the single byte
{\it i8
} to the stream.
132 \membersection{wxTextOutputStream::Write16
}
134 \func{void
}{wxTextOutputStream::Write16
}{{\param wxUint16
}{i16
}}
136 Writes the
16 bit integer
{\it i16
} to the stream.
138 \membersection{wxTextOutputStream::Write32
}
140 \func{void
}{wxTextOutputStream::Write32
}{{\param wxUint32
}{i32
}}
142 Writes the
32 bit integer
{\it i32
} to the stream.
144 \membersection{wxTextOutputStream::WriteDouble
}
146 \func{void
}{wxTextOutputStream::WriteDouble
}{{\param double
}{f
}}
148 Writes the double
{\it f
} to the stream using the IEEE format.
150 \membersection{wxTextOutputStream::WriteString
}
152 \func{void
}{wxTextOutputStream::WriteString
}{{\param const wxString\&
}{string
}}
154 Writes
{\it string
} as a line. Depending on the operating system, it adds
155 $
\backslash$n or $
\backslash$r$
\backslash$n.