1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-16 11:21:18 +03:00

Trying to fix seek() / peek() interactions.

This commit is contained in:
David A. Mellis
2010-12-22 16:37:48 -06:00
parent 4742739d6e
commit a7a8f3fa10
4 changed files with 169 additions and 11 deletions

View File

@ -15,14 +15,17 @@
#include <SD.h>
void File::write(uint8_t val) {
SD.c = -1;
SD.file.write(val);
}
void File::write(const char *str) {
SD.c = -1;
SD.file.write(str);
}
void File::write(const uint8_t *buf, size_t size) {
SD.c = -1;
SD.file.write(buf, size);
}
@ -52,10 +55,12 @@ void File::flush() {
}
boolean File::seek(uint32_t pos) {
SD.c = -1;
return SD.file.seekSet(pos);
}
uint32_t File::position() {
if (SD.c != -1) return SD.file.curPosition() - 1;
return SD.file.curPosition();
}