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

Replacing boolean parameters to SD.open() with SD_MODE constants.

This commit is contained in:
David A. Mellis
2010-11-28 12:43:13 -06:00
parent 00a9f99c9b
commit ff89afb606
4 changed files with 27 additions and 20 deletions

View File

@ -15,11 +15,25 @@ void setup()
ATS_PrintTestStatus("SD.begin()", b = SD.begin(4));
if (!b) goto done;
f = SD.open("test.txt", true, false);
f = SD.open("test.txt", SD_TRUNCATE);
ATS_PrintTestStatus("SD.open()", f);
if (!f) goto done;
f.print("abcdefgh");
f.print("1234");
f.close();
f = SD.open("test.txt", SD_TRUNCATE);
ATS_PrintTestStatus("SD.open()", f);
if (!f) goto done;
f.print("abcde");
f.close();
f = SD.open("test.txt", SD_APPEND);
ATS_PrintTestStatus("SD.open()", f);
if (!f) goto done;
f.print("fgh");
f.close();
f = SD.open("test.txt");
@ -57,7 +71,7 @@ void setup()
f.close();
f = SD.open("test2.txt", true, false);
f = SD.open("test2.txt", SD_TRUNCATE);
ATS_PrintTestStatus("SD.open()", f);
if (!f) goto done;

View File

@ -13,7 +13,7 @@ void setup()
if (!b) goto done;
ATS_PrintTestStatus("!SD.exists()", !SD.exists("asdf.txt"));
ATS_PrintTestStatus("SD.open()", f = SD.open("asdf.txt", true)); f.close();
ATS_PrintTestStatus("SD.open()", f = SD.open("asdf.txt", SD_TRUNCATE)); f.close();
ATS_PrintTestStatus("SD.exists()", SD.exists("asdf.txt"));
ATS_PrintTestStatus("SD.exists()", SD.exists("/asdf.txt"));
ATS_PrintTestStatus("SD.remove()", SD.remove("asdf.txt"));
@ -48,13 +48,13 @@ void setup()
ATS_PrintTestStatus("!SD.exists()", !SD.exists("x/y"));
ATS_PrintTestStatus("!SD.exists()", !SD.exists("x/y/z"));
ATS_PrintTestStatus("!SD.open()", !(f = SD.open("asdf/asdf.txt", true))); f.close();
ATS_PrintTestStatus("!SD.open()", !(f = SD.open("asdf/asdf.txt", SD_TRUNCATE))); f.close();
ATS_PrintTestStatus("!SD.exists()", !SD.exists("asdf"));
ATS_PrintTestStatus("!SD.exists()", !SD.exists("asdf.txt"));
ATS_PrintTestStatus("!SD.exists()", !SD.exists("asdf/asdf.txt"));
ATS_PrintTestStatus("SD.mkdir()", SD.mkdir("asdf"));
ATS_PrintTestStatus("SD.exists()", SD.exists("asdf"));
ATS_PrintTestStatus("SD.open()", f = SD.open("asdf/asdf.txt", true)); f.close();
ATS_PrintTestStatus("SD.open()", f = SD.open("asdf/asdf.txt", SD_TRUNCATE)); f.close();
ATS_PrintTestStatus("SD.exists()", SD.exists("asdf/asdf.txt"));
ATS_PrintTestStatus("!SD.rmdir()", !SD.rmdir("asdf"));
ATS_PrintTestStatus("SD.exists()", SD.exists("asdf"));