Adds some helper functions to std::filebuf:
More...
#include <filebuf.h>
Adds some helper functions to std::filebuf:
- getline()
- read and write of unsigned integers with size of 32/24/16/8 bit.
Definition at line 35 of file filebuf.h.
◆ getline()
| size_t Filebuf::getline |
( |
char * |
str, |
|
|
size_t |
count |
|
) |
| |
|
inline |
Equivalent to std::fstream::getline, but faster (no sentry [27.7.2.1.3]).
Extracts characters from *this and stores them in successive locations of the array whose first element is pointed to by str, until the end of line ('\n' char) or the end of file condition occurs. The '\n' char is not stored into str, and a null character, even in case of errors, is appended.
Typical usage:
while (
file.getline(buf,
sizeof buf)) {
}
- Parameters
-
| str | pointer to the character string to store the characters to |
| count | size of character string pointed to by str |
- Returns
- the number of characters read, including the '\n' char
- 0 on failure or if the buffer is too small.
Definition at line 86 of file filebuf.h.
◆ Open()
Opens a file.
- Parameters
-
| filename | path to the file to be opened. |
| fmode | open the file for reading, writing, or both. |
- Returns
- OK on success, an errorT code on failure.
Definition at line 43 of file filebuf.h.
◆ ReadFourBytes()
| uint32_t Filebuf::ReadFourBytes |
( |
| ) |
|
|
inline |
Reads a 32-bit unsigned integer.
This function do not check for errors or EOF.
Definition at line 129 of file filebuf.h.
◆ ReadOneByte()
| byte Filebuf::ReadOneByte |
( |
| ) |
|
|
inline |
Reads a 8-bit unsigned integer.
This function do not check for errors or EOF.
Definition at line 111 of file filebuf.h.
◆ ReadThreeBytes()
| uint32_t Filebuf::ReadThreeBytes |
( |
| ) |
|
|
inline |
Reads a 24-bit unsigned integer.
This function do not check for errors or EOF.
Definition at line 123 of file filebuf.h.
◆ ReadTwoBytes()
| uint16_t Filebuf::ReadTwoBytes |
( |
| ) |
|
|
inline |
Reads a 16-bit unsigned integer.
This function do not check for errors or EOF.
Definition at line 117 of file filebuf.h.
◆ WriteFourBytes()
| int Filebuf::WriteFourBytes |
( |
uint32_t |
value | ) |
|
|
inline |
Writes a 32-bit unsigned integer.
- Returns
- the number of characters successfully written.
Definition at line 161 of file filebuf.h.
◆ WriteOneByte()
| int Filebuf::WriteOneByte |
( |
byte |
value | ) |
|
|
inline |
Writes a 8-bit unsigned integer.
- Returns
- the number of characters successfully written.
Definition at line 135 of file filebuf.h.
◆ WriteThreeBytes()
| int Filebuf::WriteThreeBytes |
( |
uint32_t |
value | ) |
|
|
inline |
Writes a 24-bit unsigned integer.
- Returns
- the number of characters successfully written.
Definition at line 152 of file filebuf.h.
◆ WriteTwoBytes()
| int Filebuf::WriteTwoBytes |
( |
uint32_t |
value | ) |
|
|
inline |
Writes a 16-bit unsigned integer.
- Returns
- the number of characters successfully written.
Definition at line 144 of file filebuf.h.
The documentation for this class was generated from the following file: