Thare are these functions:
Code:
int ctoi(char source)
{ /* Converts a character 0-9 to its equivalent integer value */
if((source >= '0') && (source <= '9'))
return (source - '0');
return(source - 'A' + 10);
}
char itoc(int source)
{ /* Converts an integer value to its hexadecimal character */
if ((source >= 0) && (source <= 9)) {
return ('0' + source); }
else {
return ('A' + (source - 10)); }
}
StrToInt working. But I'm still confused, what difference between ctoi() and atoi() if char in C is byte? You told C.atoi() = Delphi.StrToInt(), the same doing ctoi()?
Code:
s = "C++";
i = atoi(s[0]);
i = ctoi(s[0]);
i = s[0];
What values are assigned to i in these cases?
Delphi-Quellcode:
s = 'C++';
i = Ord(s[0]);
i = StrToInt(s[0]);
i = Ord(s[0]);
?