Hi, I'm programming in C, on mandrake linux. I was wondering if there's any easy way to convert a string of letters into their 'character code' (or decimal) equivalent? I know of one long way round, which would be to make a list of all of the characters and numbers equivalent to each other, then call that list for reference every time I wish to convert a character, but i'm sure it can be done another way.
Any ideas? I heard atoi() converts a string, or character into an integer, but whatever character, or string i give it, it keeps returning 0, not the decimal equivalent.
main(int argc, char *argv)
//execl("/usr/bin/konqueror", " cnn.com", (char *) 0);
//define char variable for the app name.
char ichar = "konqueror ";
//define a char variable for the command to be converted.
char arbit = "dir";
//check we have 4 arguments in total.
if (argc != 4)
//add argv to the end of the ichar string.
strcat (ichar, argv);
//run the command.
//convert string to decimal.
/*THE FOLLOWING DOESNT WORK
char my_string = "a";
printf("%s = %d\n", my_string);
printf ("%s\n", ichar);
SO IT'S COMMENTED OUT*/
Any help would be much appreciated.