Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Character array to ASCII

Status
Not open for further replies.

EauDeNil

Programmer
Aug 13, 2002
1
US
I'm looking for a way to run through a character array and get the ascii code numbers for each letter.
 
you can do it like this:
Code:
#include <ctype.h>
.....
...
char *str = &quot;hello world !&quot;;
for( int i = 0; str[i] != 0; i++)
{
     __toascii( str[i] );
}
....
 
char* astr = &quot;ropey&quot;;
for (int i = 0; astr; i++)
printf (&quot;%d &quot;, (int) astr);
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top