double atof( const char *string ); s = "7.8912654773d210"; /* Test of atof */ x = atof( s ); printf( "atof test: ASCII string: %s\tfloat: %e\n", s, x );
用sscanf最方便:const char *pData="23.00";double dbData; int nResult; nResult=sscanf(pData,"%lf",&dbData); ASSERT(nResult==1);
x = atof( s );
printf( "atof test: ASCII string: %s\tfloat: %e\n", s, x );
int nResult;
nResult=sscanf(pData,"%lf",&dbData);
ASSERT(nResult==1);