1
0
mirror of https://github.com/Dejvino/lilybook.git synced 2024-11-14 12:23:28 +00:00
lilybook/main/modes/reader/TextStorage.cpp

26 lines
515 B
C++
Raw Normal View History

2020-01-31 19:54:19 +00:00
#include "TextStorage.h"
#include "esp_log.h"
static const char *TAG = "TextStorage";
TextStorage::TextStorage()
{}
TextReader* TextStorage::open(char* filename)
{
FILE* f = fopen("/sdcard/book.txt", "r");
if (f == NULL) {
ESP_LOGE(TAG, "File could not be opened");
return NULL;
}
ESP_LOGI(TAG, "File opened for reading.");
return new TextReader(f);
}
void TextStorage::close(TextReader* reader)
{
reader->close();
delete reader;
ESP_LOGI(TAG, "File closed.");
}