1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-07-30 16:24:09 +03:00

Revising SD library API.

Open now returns a file object (which has a close() method); exists() no longer accepts a parent directory.
This commit is contained in:
David A. Mellis
2010-11-19 22:30:40 -05:00
parent 06d3d85143
commit a5898ae26a
3 changed files with 72 additions and 23 deletions

39
libraries/SD/File.cpp Normal file
View File

@ -0,0 +1,39 @@
/*
SD - a slightly more friendly wrapper for sdfatlib
This library aims to expose a subset of SD card functionality
in the form of a higher level "wrapper" object.
License: GNU General Public License V3
(Because sdfatlib is licensed with this.)
(C) Copyright 2010 SparkFun Electronics
*/
#include <SD.h>
void File::write(uint8_t val) {
SD.file.write(val);
}
void File::write(const char *str) {
SD.file.write(str);
}
void File::write(const uint8_t *buf, size_t size) {
SD.file.write(buf, size);
}
int File::read() {
return SD.file.read();
}
void File::close() {
SD.file.close();
}
File::operator bool() {
return SD.file.isOpen();
}