From 5057d5b10955ec0923f2b323b68ad9c7d6fb0b40 Mon Sep 17 00:00:00 2001 From: "David A. Mellis" Date: Wed, 22 Dec 2010 15:11:54 -0600 Subject: [PATCH] Adding seek() and size() functions to SD File class. --- libraries/SD/File.cpp | 8 ++++++++ libraries/SD/SD.h | 2 ++ 2 files changed, 10 insertions(+) diff --git a/libraries/SD/File.cpp b/libraries/SD/File.cpp index d09bd8f85..e12b81bc1 100644 --- a/libraries/SD/File.cpp +++ b/libraries/SD/File.cpp @@ -51,6 +51,14 @@ void File::flush() { SD.file.sync(); } +boolean File::seek(uint32_t pos) { + return SD.file.seekSet(pos); +} + +uint32_t File::size() { + return SD.file.fileSize(); +} + void File::close() { SD.file.close(); } diff --git a/libraries/SD/SD.h b/libraries/SD/SD.h index d013bcfc5..bda862d54 100644 --- a/libraries/SD/SD.h +++ b/libraries/SD/SD.h @@ -33,6 +33,8 @@ public: virtual int peek(); virtual int available(); virtual void flush(); + boolean seek(uint32_t pos); + uint32_t size(); void close(); operator bool(); };