Look at the fallowing code:
String received = "";
ch = file.read();
if (ch == '\n')
received += ch;
The code works just fine. Still, I do not understand 2 things !!!
First, inside while loop there is file.available(). While loop executes code as long as file.available() is not 0. I know that file.available() returns the number of bytes available (int) on SD card. But I saw nowhere in books that the number is decremented !!! Is it true that file.available() decrements ??? When is it decremented ?
Second, I know that file.read() reads the next byte (or character), or -1 if none is available. But in this while loop, file.read() reads next character or byte and it is like there is some internal pointer that increments after reading one byte or character ! Is there a way to see what is the current value of that pointer. Can I set that pointer to some wanted value ?