Method | Description |
int Read() | Returns an integer representation of the next available character. Returns -1 when the end of the file is encountered. |
int Read(byte[ ] buf, int offset, int num) | Attempts to read up to num bytes into buf starting at buf[offset], returning the number of bytes successfully read. |
int Read(char[ ] buf, int offset, int num) | Attempts to read up to num characters into buf starting at buf[offset], returning the number of characters successfully read. |
Commonly Used Input Methods Defined by BinaryReader
Method | Description |
bool ReadBoolean() | Reads a bool. |
byte ReadByte() | Reads a byte. |
sbyte ReadSByte() | Reads an sbyte |
byte[] ReadBytes(int num) | Reads num bytes and returns them as an array. |
char ReadChar() | Reads a char. |
char[] ReadChar(int num) | Reads num characteds and returns them as an array |
double ReadDouble() | Reads a double |
float ReadSingle() | Reads a float |
short ReadInt16() | Reads a short |
int ReadInt32() | Reads an int |
long ReadInt64() | Reads a long |
ushort ReadUInt16() | Reads a ushort |
uint ReadUInt32() | Reads a uint |
ulong ReadUInt64() | Reads a ulong |
string ReadString() | Reads a string that has been written using a BinaryWriter. |
15.26.BinaryReader | ||||
15.26.1. | BinaryReader | |||
15.26.2. | Read decimal, strings and char from a binary file using the BinaryReader | |||
15.26.3. | Reset the file pointer to the start | |||
15.26.4. | Use BinaryReader to read file in binary format |