Hi. I have been left some code by a previous design engineer which i need to compile. However when i try to compile the code it is giving the following warning:
error C2371: 'strtod' : redefinition; different basic types
c:\program files\microsoft visual studio\vc98\include\stdlib.h(309) : see declaration of 'strtod'
The code is given below:-
Does anybody have any idea what is wrong? ThanksCode:float strtod(char *s,char *endptr) { float pow10 = 1.0; float result = 0.0; int sign = 0, point = 0; char c; int ptr = 0; if(s) { c=s[ptr++]; } while((c>='0' && c<='9') || c=='+' || c=='-' || c=='.') { if(c == '-') { sign = 1; c = s[ptr++]; } while((c >= '0' && c <= '9') && point == 0) { result = 10*result + c - '0'; c = s[ptr++]; } if (c == '.') { point = 1; c = s[ptr++]; } while((c >= '0' && c <= '9') && point == 1) { pow10 = pow10*10; result += (c - '0')/pow10; c = s[ptr++]; } if (c == '+') { c = s[ptr++]; } } if (sign == 1) result = -1*result; if(endptr) { if (ptr) { ptr--; *((char *)endptr)=s+ptr; } else *((char *)endptr)=s; } return(result); }



LinkBack URL
About LinkBacks



