I am trying to split the following, I need to split it by the function strtok and i wanna obtain the value 1.2597, take note that Down is a dynamic word which can be change. I understand in this case i can use white space as my delimiter, and get the value [1] which is the currency, but how do i go around with it.
CCY 1.2597 Down 0.0021(0.16%) 14:32 SGT [44]
This should do it:
If you want to convert the number to a
floatordoubleyou could also usesscanf:Or just use
sscanfon the number token that you got withstrtok.