瀏覽代碼

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) {

Loading…
取消
儲存