hi
i have yun shield attached uno (using bridge)
i able read sensor , write txt without problem. values numbers < 50000. each number in separate line.
now need read file , save each line array converting unsigned int.
the idea is:
i have error on line:
"cannot convert 'string' 'const char*' argument '1' 'int atoi(const char*)'"
any on how convert string unsigned int??
thanks
pd. example useful.
i have yun shield attached uno (using bridge)
i able read sensor , write txt without problem. values numbers < 50000. each number in separate line.
now need read file , save each line array converting unsigned int.
the idea is:
code: [select]
unsigned int myarray[10];
string line;
int = 0;
file script = filesystem.open("/mnt/sda1/aaa.txt", file_read);
while (script.available())
{
line = script.readstringuntil('\n'); //read complete line
console.println("line:" + line); //print test
myarray[i] = atoi(line); // convert unsigned int
i++;
}
script.close();
i have error on line:
code: [select]
myarray[i] = atoi(line); // convert unsigned int
"cannot convert 'string' 'const char*' argument '1' 'int atoi(const char*)'"
any on how convert string unsigned int??
thanks
pd. example useful.
you may copy string char buffer tochararray , afterwards convert it.
Arduino Forum > Using Arduino > Storage > Read txt file into array
arduino
Comments
Post a Comment