[C-API] Converting string to float

Confirmed that sscanf() works with the nosys.specs thing. When I get home, I can try it on the hardware.

I'm not too familiar with Visual Studio, so I can't help you troubleshoot that. When I built it, I ran the make command from the project directory on a Debian environment.

Attached is the test program I made to try it out. It failed to build without the --specs=nosys.specs parameter as expected: sscanf.zip (72.2 KB)

It does the following:

  • Begin with the text "3.1415927"
  • Display the text on-screen
  • Process the text as a float
  • Multiply the value by 2
  • Format the result as text
  • Display the resulting text on-screen

screenshot

Per Dave's suggestion, snprintf() should be used instead of sprintf() for safety checking. I just used it because I know for sure it was also triggering the "undefined reference" errors. There is no snscanf(), unfortunately.

1 Like