This class provides functions that read text datas using an input stream. So, you can read text floats, integers.
The wxTextInputStream correctly reads text files (or streams) in DOS, Macintosh and Unix formats and reports a single newline char as a line ending.
Operator >> is overloaded and you can use this class like a standard C++ iostream. Note, however, that the arguments are the fixed size types wxUint32, wxInt32 etc and on a typical 32-bit computer, none of these match to the "long" type (wxInt32 is defined as int on 32-bit architectures) so that you cannot use long. To avoid problems (here and elsewhere), make use of wxInt32, wxUint32 and similar types.
For example:
wxFileInputStream input( "mytext.txt" ); wxTextInputStream text( input ); wxUint8 i1; float f2; wxString line; text >> i1; // read a 8 bit integer. text >> i1 >> f2; // read a 8 bit integer followed by float. text >> line; // read a text lineInclude files
<wx/txtstrm.h>
Members
wxTextInputStream::wxTextInputStream
wxTextInputStream::~wxTextInputStream
wxTextInputStream::Read8
wxTextInputStream::Read16
wxTextInputStream::Read32
wxTextInputStream::ReadDouble
wxTextInputStream::ReadString
wxTextInputStream(wxInputStream& stream)
Constructs a text stream object from an input stream. Only read methods will be available.
Parameters
stream
~wxTextInputStream()
Destroys the wxTextInputStream object.
wxUint8 Read8()
Reads a single byte from the stream.
wxUint16 Read16()
Reads a 16 bit integer from the stream.
wxUint16 Read32()
Reads a 32 bit integer from the stream.
double ReadDouble()
Reads a double (IEEE encoded) from the stream.
wxString wxTextInputStream::ReadString()
Reads a line from the stream. A line is a string which ends with \n or \r\n or \r.