1110
Appendix A: System Routines — Utilities
TI
-
89 / TI
-
92 Plus Developer Guide
Not for Distribution
Beta Version January 26, 2001
strtod
(continued)
See Also: strtol
Example:
void StrToList ( const char *str )
/* Create list of floats on estack from the string of floats */
{
Access_AMS_Global_Variables;
BCD16 num;
unsigned char * start_ptr, * end_ptr;
EStackIndex old_top, k;
end_ptr = (unsigned char *)str;
old_top = top_estack;
push_quantum (END_TAG);
while( *end_ptr )
{ /* stop when end of string or fail */
start_ptr = end_ptr; /* pt to next value to convert */
num = strtod((const char *)start_ptr, (char **)&end_ptr);
if( start_ptr == end_ptr )
break; /* conversion failed */
push_Float( num );
}
k = top_estack; /* point to last val */
push_reversed_tail (k); /* reverse the order */
delete_between (old_top, k); /* delete the old copy */
push_quantum (LIST_TAG); /* make it a list */
return;
}