浏览代码

Fix FILE_WRITE - seek to end of file at open

main
PaulStoffregen 4 年前
父节点
当前提交
53870ddc70
共有 1 个文件被更改,包括 5 次插入2 次删除
  1. +5
    -2
      src/SD.h

+ 5
- 2
src/SD.h 查看文件

@@ -108,8 +108,11 @@ public:
oflag_t flags = O_READ;
if (mode == FILE_WRITE) flags = O_READ | O_WRITE | O_CREAT;
FsFile file = sdfs.open(filepath, flags);
// TODO: Arduino's default to seek to end of writable file
if (file) return File(new SDFile(file));
if (file) {
// Arduino's default FILE_WRITE starts at end of file
if (mode == FILE_WRITE) file.seekEnd(0);
return File(new SDFile(file));
}
return File();
}
bool exists(const char *filepath) {

正在加载...
取消
保存