The file has 100 iterations of the data, and I need to convert it to a comma seperated format. |
"time:"
."ms"
. Then read each of the following pairs, (string, number). Note the last 3 are floating-point, the others are integer. time:
to light:
and then output the whole group, separated by commas and ending with a newline.so I am thinking of storing the ints and floats in an array until the set is complete. Does that sound like a viable way to start? |
|
|
Does that work like a function? |
|
|
|
|
|
|
|
|
|
|
"%f, "
depending on the type, e.g. integer of double etc of the value being printed, number of decimal places etc.
|
|
Press and release switch 0 Release switch 0 time: 0 ms switch0: 0 switch1: 0 switch2: 0 switch3: 0 potentiometer: 3.97 temperature: 0.78 light: 0.37 --------------------------- time: 40 ms switch0: 0 switch1: 0 switch2: 0 switch3: 0 potentiometer: 12.34 temperature: 0.79 light: 0.42 --------------------------- time: 22 ms switch0: 0 switch1: 0 switch2: 0 switch3: 0 potentiometer: -8.97 temperature: 0.79 light: 0.22 --------------------------- time: 40 ms switch0: 0 switch1: 0 switch2: 1 switch3: 0 potentiometer: 3.97 temperature: 0.79 light: 0.23 --------------------------- |
time, switch0, switch1, switch2, switch3, potentiometer, temperature, light 0, 0, 0, 0, 0, 3.97, 0.78, 0.37 40, 0, 0, 0, 0, 12.34, 0.79, 0.42 22, 0, 0, 0, 0, -8.97, 0.79, 0.22 40, 0, 0, 1, 0, 3.97, 0.79, 0.23 Program ended with exit code: 0 |