elad said>>
You should be able to the the atox() family to convert from string to numerical values. It's atoi() to convert to type int, atol() to convert to type long, and atof() to convert to double or float. If you want to use fractions or imaginary numbers you need to divise your own classes.
lol shows how much i know about the c++ language i made my own sub (below) to do this :P and all i really had to do was at**()
lol, thanx, btw iv used the array sub idea for the multi level procs;
Code:
double StringToValue(char T1[])
{
char NumberBuffer[12] = "0123456789.";
int pval=0;
int cval=0;
int xval=0;
double magval=1;
double endval=0;
int tlen=StringLength(T1);
int cc=1; // 1 or else it will loop 1 more than expected if 0
int repmag=tlen;
int pp=0;
while (pp<tlen)
{
if(T1[pp] == NumberBuffer[10])
{
repmag=pp; //find the true length of <= whole numbers so it will correctly divide into floats
//the . and array 0 cancel each other out
break;
}
++pp;
}
while (cc<repmag)
{
magval*=10;
++cc;
}
while(pval<tlen) // < than or else it will loop 1 more than expected if <= to
{
while(cval<=9)
{
if (((int)T1[pval]) == ((int)NumberBuffer[cval]))
{
endval+=(cval*magval); //yay the value ^_^
cval=0;
break;
}
if (((int)T1[pval]) == ((int)NumberBuffer[10]))
{
//return the .
cval=0;
break;
}
++cval;
}
magval/=10;
++pval;
}
return endval;
}