I have a .csv file and I want to read the data in its format, not at string. This is the function that save the file in a readbuffer if is ok.
fileGetString(readbuffer,elcount(readbuffer),readHandle)!=0)
And I have the data is in this format:
Temperature;12.25;15.65;-25.12;80;
Time;1;2;4;7;
I want save the temperature in a buffer "Temperature[i]
"
and do the same with the time "Time[i]
"
How can I do this in CAPL?
I know that I can read each data like String and cast to integer or float doing some operations, but I want optimize code and read each data in its format.
You can convert an string to an float number using
strtod()
. Just for fun, here is complete example:Output: