Mail Archives: djgpp/1997/03/01/23:28:18
On 1 Mar 1997, rellwood wrote:
> Is there a function I can use to convert a char to an int? The closest
> thing I can find is atoi(), which actually converts a string. Is there
> anything better?
>
> -Richard
>
Why do you want to do this? In C and C++, a char can be automatically
converted into an int. The resulting integer contains the ASCII code of
the character. For instance,
int sample = 'X'; /* sample == 88 on most systems */
Is this _really_ what you want to do? It's perfectly legal, and will work
as advertised as long as you know what you're doing.
---Michael Phelps
morphine AT cs DOT jhu DOT edu
CH3
|
N
/ |
______/ |
/ \ CH2
_____/ \__|__
// \\ / | \\
// \\______/___CH2 \\
\ / \ /
\______/ \_____/
/ ------ \ / \
OH \ / OH
O
Morphine
- Raw text -