Yes. Read each character from the file. If the character is not a carriage return, store the character in the next position in an array, and increment the index.
If the character IS the carriage return, store a NULL in the next position in the array, and then use strtok() and atoi() or atof() to convert each token to an int or a float. Then, reset the index to 0 and put a NULL in the 0th position of the array.
but wont that save all values in one row into one variable? unless i have a statement that checks if the character is a " " or something, then it can convert the saves characters into an int, then continue until a carriage return. increase the index for the final saved ints and repeat for the whole file.
but how do i check each character individually? this method does take time though?
so far my knowledge is limited to "data.read(distance.txt)"
What are you using (post code) that isn't reading from the SD card one character (byte) at time?
So on the premise your program is reading one character at a time. If the character is not a space then add to a char[]. If the new character is a space then convert the char[] to the number value (atoi or atof) and store in the corresponding variable (a counter and switch statement could help with this if the variables are not an array).
my bad, i just didnt understand how the SD card read worked, i just need it to read values and store them with a counter to split them into variables.
i have 4 variables that represent the data (distance values) that change a few times a second, so i created a 2D array to store the values. it reads the char in the sd card, saves them to an array, converts them to an int when a " " is reached. then it increases the counter and resets the array counter. at a counter of 4, it resets back to 0 and starts all over again for the next set of data.