So I have a programme that loads a text file from an sd card into a string array. Each line in the text file is stored in a different string in a string array. Well its supposed to be.
file = SD.open("/classes/basic.txt", FILE_READ);
Serial.print("Reading, Checking and Compiling \n\n\n");
for(int i = 0; i < sizeof(result)-1;i++){
while(file.available()) {
character23 = file.read();
content.concat(character23);
}
if (content != "") {
result[i] = content;
Serial.println(content);
}
}
I want each line in the txt file to be stored in a different string in the array, in chronological order and each string has to be accessible individually. The problem with this code is that it stores the whole text file in one string. How can I fix this?
EDIT: here is what I have now
file = SD.open("/classes/basic.txt", FILE_READ);
Serial.print("Reading, Checking and Compiling \n\n\n");
for(int i = 0; i < sizeof(result)-1;i++){
while(file.available()) {
character23 = file.read();
if (character23 == '^') break;
content.concat(character23);
}
if (content != "") {
result[i] = content;
Serial.println(content);
delay(1000);
}
} Serial.println(result[3]);