how can i use strtod to check number

hello, i got a task for check whether a char * is a number
for example:
 
char *strings = ".3.3.34";

which supposed it's not a number

a number should be have a few conditions, number or number dot number
like: 45, 45.25

cuz im not familiar with strtod()

i guess the way to check is handling exception like
1
2
3
4
5
6
try{
   //strtod(something)
   if(test_fail)
      //not a number
   else
      //it's a number 


need help, thanks
strtod will not throw anything. I suppose you'll have to do it manually. In a for loop check that there is only one . and that all other chars are valid digits.
Topic archived. No new replies allowed.