This is the code to read and print a character at a time.
uint8_t c;
while(params.read(&c, 1) == 1) {
Serial.print(c);
//delay(250);
}
If you look at the documentation for read, you'll notice that you can specify an array as the first argument, and that the second argument is the array length (the number of characters to read). So, you can read more than one character at a time.
That would help if all your records were fixed length. You could read an entire record at once.
Since yours are not, you need to store the characters read from the file.
char record[80]; // store the record here
byte index = 0;
uint8_t c;
while(params.read(&c, 1) == 1)
{
if(c == '\n') // If we found the carriage return...
{
// parsing happens here, if index > 0
// reset to read next record
index = 0;
record[index] = '\0';
}
else if(c != '\r') // ignore line feed
{
// save the character
record[index++] = c;
// append a NULL
record[index] = '\0';
}
}
Where the comment says parsing happens here, you'd have some code like:
if(index > 0)
{
char *nameToken = strtok(record, "=");
if(nameToken)
{
char *valueToken = strtok(NULL, "\0");
if(valueToken)
{
}
}
}
In the (empty) if block, you'd add code to see if the nameToken matched (using strcmp()) any expected values. If so, you could use atoi(), atof(), or strdup() to convert/copy the value to the appropriate type (float, int, or string).