mirror of
https://github.com/Dejvino/lilybook.git
synced 2024-11-14 12:23:28 +00:00
26 lines
515 B
C++
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.");
|
||
|
}
|