1
0
mirror of https://github.com/Dejvino/lilybook.git synced 2024-09-28 01:43:37 +00:00
lilybook/main/TextStorage.cpp
2020-01-31 20:54:19 +01:00

26 lines
515 B
C++

#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.");
}