Add File::open_for_reading().

Barf.
This commit is contained in:
Jared Boone 2016-04-10 15:56:34 -07:00
parent 38ba02a68f
commit 0a9d7ec8d8
2 changed files with 6 additions and 0 deletions

View File

@ -30,6 +30,11 @@ bool File::open_for_writing(const std::string& file_path) {
return (open_result == FR_OK);
}
bool File::open_for_reading(const std::string& file_path) {
const auto open_result = f_open(&f, file_path.c_str(), FA_READ | FA_OPEN_EXISTING);
return (open_result == FR_OK);
}
bool File::open_for_append(const std::string& file_path) {
if( open_for_writing(file_path) ) {
const auto seek_result = f_lseek(&f, f_size(&f));

View File

@ -33,6 +33,7 @@ public:
~File();
bool open_for_writing(const std::string& file_path);
bool open_for_reading(const std::string& file_path);
bool open_for_append(const std::string& file_path);
bool close();