3
我想打開一個文件,我計算出一個字符串的名稱。但是,它只是給我編譯錯誤,如圖所示。Arduino打開SD文件名作爲字符串
for(int i=1;;i++)
{
String temp = "data";
temp.concat(i);
temp.concat(".csv");
if(!SD.exists(temp))//no matching function for call to sdclass::exists(String&)
{
datur = SD.open(temp,FILE_WRITE);
}
}
我是一個java人,所以我不明白爲什麼這是行不通的。我嘗試了幾個字符串對象方法,但似乎沒有工作。我在arduino編程方面有點新,但我更瞭解java。這個for循環的重點是每次arduino重新啓動時創建一個新文件。
非常感謝! working – Wijagels
爲什麼這些函數不能接受'const char *',比如'temp.c_str()'返回的函數?這會讓生活變得如此簡單。 SD.exists函數無意改變文件名。 – sauerburger