diff --git a/libraries/Bridge/src/FileIO.cpp b/libraries/Bridge/src/FileIO.cpp index be94a3cc4..437ae2241 100644 --- a/libraries/Bridge/src/FileIO.cpp +++ b/libraries/Bridge/src/FileIO.cpp @@ -137,7 +137,21 @@ int File::available() { void File::flush() { } -//int read(void *buf, uint16_t nbyte) +int File::read(void *buff, uint16_t nbyte) { + uint16_t n = 0; + uint8_t *p = reinterpret_cast(buff); + while (n < nbyte) { + if (buffered == 0) { + doBuffer(); + if (buffered == 0) + break; + } + *p++ = buffer[readPos++]; + buffered--; + n++; + } + return n; +} uint32_t File::size() { if (bridge.getBridgeVersion() < 101)