try this:
#include <stdio.h>
float f=0;
int n = sscanf("2345test", "%f", &f);
The integer returned by
scanf(...)
family is the number of successfully converted values. In this case it would be 1 because 2345 can be converted into a float.
If something is entered that cannot be converted into a floating point number the result will be 0.
scanf(...)
is very "multi-purpose" - it is possible to scan for integers and strings, too. So you should check the documentation on it.