How to split up CAN data line
Hi,
I'm sure there must be a very simple solution for this, but i don't now the right C functions to do it. Therefore I hope someone can help me out with this.
I'm working with CAN (Controller Area Network) data and I've got strings returned, like these:
Code:
0.7746 1 861 Rx d 8 16 3 32 0 0 255 80 0
0.7821 1 861 Rx d 8 16 3 32 0 0 0 80 0
The exact meaning of the data is not important I think. I'll use one as an example though.
The first value of the line (0.7746 and 0.7821) is the time of the CAN message in ms. Now what I need to do is categorise the data seperately. So I want an array to be filled with those times e.g. time_array(0.7746,0.7821,...). And so on... I need to do this with all the values in the lines above, another example: identifier_array(861,861,...).
Again, I'm sure there's a function that can seperate the values (with the space as a "separate-parameter") like explode in php but I don't know how to do this in C.
Could anyone point me to an example or help me out some way please?
Thanks in advance, René