I call the function StrToLL, below, with the following call like:
unsigned long long x;
x = StrToLL(inputStr); // string filled with input from field
FrmCustomAlert(altNotice, "x=", StrIToA(buf, x), "Ok!");
I make this call to convert a string to a Long. The function
works because I can see the value in the Debug Popup form in the
function. But when I check the return value, right after the call,
with the Debug Popup form, the value is zero.
How is this possible? Why does the value for the Long (x) get
reset to zero?
Here is the function StrToLL:
unsigned long long StrToLL(char *s) {
int i, t;
unsigned long long x = 0;
char buf[20];
char a64[23] = "0123456789ABCDEFabcdef";
for (i = 0; i < StrLen(s); i++) {
t = StrChr(a64, s[i]) - a64; // index of char s[i] in a64
x = ((x * 16) + StrChr(a64, s[i]) - a64);
}
// next line just pops up dialog with and displays the correct
// value of x. So the function computes the correct value.
// but right after the call to this function the value
// is zero.
FrmCustomAlert(altNotice, "x=", StrIToA(buf, x), "Ok!");
return (unsigned long long) x;
}
--
-----------------------------------------------------------------
Discussion Group: http://www.halcyon.com/ipscone/wwwboard/
Protect your constitutional rights. Your favorite one may be next!
-----------------------------------------------------------------