class oeifstream : public oeistream
This class represents oeifstream.
Implements an input stream capable of reading from a specified file or from any generic data source with an associated file descriptor.
The following methods are publicly inherited from oeistream:
The following methods are publicly inherited from oestream:
oeifstream() oeifstream(int ifd) oeifstream(const char *filename) oeifstream(const std::string &filename)
Creates a new oeifstream. If a valid file descriptor (‘ifd’)
is passed to the constructor, the stream will use the associated data source
for input. Otherwise, the constructors expect the name of an
existing file from which to read. If no parameter is passed to the
constructor, the stream can later be opened using the open command
defined in oeistream or the
command defined in this class.
int fd() const
Returns the system dependent file descriptor associated with the stream’s data source.
bool openfd(int ifd, bool closefd)
Sets the data source of the stream to the specified file descriptor
‘ifd’. If ‘closefd’ is
false, the underlying data source
is not closed before changing to the new data source.
oesize_t pread(char *buffer, oesize_t len, oefpos_t offset) const
Reads ‘len’ bytes into ‘buffer’ at the specified ‘offset’ in the file. Returns the number of bytes actually read. This method allows multiple threads to safely read from a single file descriptor.
It is undefined behavior to mix calls to ‘pread’ other oeistream read method calls on the same object.