Go Down

Topic: arduino to read CSV (Read 955 times) previous topic - next topic

binooetomo

Dear All.
I just trying to use SdFatLib ... specialy the "tail" sample.

Now .. I have a file called "MYSTEP.CSV" on my sdcard.
The SdFatLib success to "tail" the file content.

basically .. the contents is just a comma seperated values like
Code: [Select]

7768,253
7957,254
8547,253
8705,254
10133,255
10293,254
10831,255
11031,254


Question :
How to parse a line to two variable, i.e :
Code: [Select]

7768,253
to -->
var1 = 7768
var2 = 253


Sincerely
-bino-

Grumpy_Mike

Get the value into a string.
Step through the string until you see a space. Then from that point to start of the string generate a sub string, that contains your first variable.
Carry on stepping through and note the position of the first number.
Then step through until you get to a none number and make the second sub string.

Go Up