user16124: 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]);

user6424: To do that, you need to read the file until you reach a line break. 
Replace this code:
while(file.available()) {
  character23 = file.read();
  content.concat(character23);
}

by this:
while(file.available()) {
   character23 = file.read();
   if (character23 == '\n') break;
   content.concat(character23);
}


16124: <p>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.</p>

<pre><code>file = SD.open("/classes/basic.txt", FILE_READ);
Serial.print("Reading, Checking and Compiling \n\n\n");  

for(int i = 0; i &lt; sizeof(result)-1;i++){
 while(file.available()) {
  character23 = file.read();
  content.concat(character23); 

}    
if (content != "") {     
  result[i] = content;
    Serial.println(content);

}
</code></pre>

<p>}</p>

<p>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?</p>

<p>EDIT: here is what I have now</p>

<pre><code>  file = SD.open("/classes/basic.txt", FILE_READ);
  Serial.print("Reading, Checking and Compiling \n\n\n");  

 for(int i = 0; i &lt; 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);
}
</code></pre>

<p>}
 Serial.println(result[3]);</p>
 6424: <p>To do that, you need to read the file until you reach a line break. </p>

<p>Replace this code:</p>

<pre><code>while(file.available()) {
  character23 = file.read();
  content.concat(character23);
}
</code></pre>

<p>by this:</p>

<pre><code>while(file.available()) {
   character23 = file.read();
   if (character23 == '\n') break;
   content.concat(character23);
}
</code></pre>
