Convert string of variable length to floats.

Hello!
How do I get is drawn only one pixel for each value of the buf by varying the cordenanda x because of the way it is written it draws several pixels for each value of buf forming a line.

Thank you.