如何修复Arduino中的"converting to 'const String' from initializer list would use explicit constructor '



Using an Arduino.我有这段代码可以逐行读取文件作为字符串。然后将此字符串插入到 http url 字符串中。这是代码。所有这些除了"文件....."和 'String addr1' 进入循环内部

String addr1 = "https://docs.google.com/forms/.......................14=happy";
String sd_data;
File testfile; // these parts come before void setup()
testfile = SD.open("testdata.txt", FILE_READ); //goes in the loop
while (testfile.available()) {
sd_data = testfile.readStringUntil('n');
sd_data.replace(' ', '+'); // replace spaces with +
addr1.replace('happy', sd_data);
}

我收到此错误 从初始值设定项列表转换为"const String"将使用显式构造函数"String::String(int,无符号字符(">

我已经解决了问题,删除

String addr1=.........

而不是

addr1.replace('happy', sd_data);

String var="https://docs.google.com/forms/.......................14="+sd_data;

相关内容

最新更新