# Need help with reading line by line - SD card

Hi,

I need a little help to find a solution to this code:

code snippet:

``````            myFile = SD.open("test.txt");
if (myFile) {

// read from the file until there's nothing else in it:

while (myFile.available()) {

for (int i = 0; i <= req.length(); i++) {
client.println(req[i]);
client.println('\n');

}
}
// close the file:
myFile.close();
``````

Browser output:

``````2 0 2 0 , 3 , 7 , 6 , 5 , 3 0 , 2 , 3 , n a n , n a n , 0 * 2 0 2 0 , 3 , 7 , 6 , 5 , 3 0 , 2 , 3 , n a n , n a n , 0 * 2 0 2 0 , 3 , 7 , 6 , 5 , 3 0 , 2 , 3 , n a n , n a n , 0 * 2 0 2 0 , 3 , 7 , 6 , 5 , 3 0 , 2 , 3 , n a n , n a n , 0 * 2 0 2 0 , 3 , 7 , 6 , 5 , 3 0 , 2 , 3 , n a n , n a n , 0 * 2 0 2 0 , 3 , 7 , 6 , 5 , 3 0 , 2 , 3 , n a n , n a n , 0 * 2 0 2 0 , 3 , 7 , 6 , 5 , 3 0 , 2 , 3 , n a n , n a n , 0 * 2 0 2 0 , 3 , 7 , 6 , 5 , 3 1 , 2 , 3 , n a n , n a n , 0 * 2 0 2 0 , 3 , 7 , 6 , 5 , 3 1 , 2 , 3 , n a n , n a n , 0 * 2 0 2 0 , 3 , 7 , 6 , 5 , 3 1 , 2 , 3 , n a n , n a n , 0 * 2 0 2 0 , 3 , 7 , 6 , 5 , 3 1 , 2 , 3 , n a n , n a n , 0 * 2 0 2 0 , 3 , 7 , 6 , 5 , 3 1 , 2 , 3 , n a n , n a n , 0 * 2 0 2 0 , 3 , 7 , 6 , 5 , 3 1 , 2 , 3 , n a n , n a n , 0 *
``````

I have been playing around with a lot of different codes, but nothing seem to work for me.

I need it to be more readable, I think about to split it by " * ".

So it looks like:
2 0 2 0 , 3 , 7 , 6 , 5 , 3 1 , 2 , 3 , n a n , n a n , 0
2 0 2 0 , 3 , 7 , 6 , 5 , 3 1 , 2 , 3 , n a n , n a n , 0
2 0 2 0 , 3 , 7 , 6 , 5 , 3 1 , 2 , 3 , n a n , n a n , 0

So I can get every comma separated data, for building a nice website output.

But how - do I do it?

Any idea?

/jokerper

It seems that your real problem is that you are simply not sending the data to SD in the proper manner.
Strings are always a bad idea and quite unwarranted here. It is OK to just send the values and the commas in order.

Get rid of that useless “*”, and use