C++ Complementary Library
This class represents a file in the file system.
Constructs a file object not associated with any file.
Constructs a file object and opens the file at the given path with the given access mode and sets up an I/O buffer with the given capacity.
The path to the file to open.
The access mode to open the file in. This tells whether you want to just read, just write or both read and write. This cannot be changed later unless you close the file and reopen it.
The action to take if the specified file does not exist. This can be if_not_there::create, which causes the file to be created, or if_not_there::fail, which causes this constructor to construct a closed file object.
The capacity of the I/O buffer to associate with this file object.
Move-constructs a file from an existing one.
The file to move from.
Move-assigns a file into this one.
The file to move from.
Returns true if the file is open. Otherwise, returns false.
Returns the position this file is at, that is, the position at which read and write operations will take place next.
Opens the file at the given path with the given access mode. The last argument tells what to do if the specified file doesn't already exists, that is, whether to create the file or fail to open it. Returns true if opening the file succeeds. Otherwise, returns false.
The path to the file to open.
The access mode to open the file in. This tells whether you want to just read, just write or both read and write. This cannot be changed later unless you close the file and reopen it.
The action to take if the specified file does not exist. This can be if_not_there::create, which causes the file to be created, or if_not_there::fail, which causes this function to simply return false without taking any action.
Flushes the I/O buffer and closes the file.
Copyright © 2022-2025 Daniel T. McGinnis