Created
December 30, 2020 21:08
-
-
Save bynect/c5dba6562da4cba67a2cc1885d6a62d3 to your computer and use it in GitHub Desktop.
A shell utility that prints the integer value of the given ascii characters.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* ascii.c -- print the integer value of the given ascii chars */ | |
/* | |
compilation: | |
cc ascii.c -o ascii | |
usage: | |
ascii your characters here [...] | |
*/ | |
#include <stdio.h> | |
#include <string.h> | |
int | |
main(int argc, char **argv) | |
{ | |
int i, j, l; | |
if (argc == 1) | |
return 1; | |
for (i = 1; i < argc; ++i) { | |
if (argc > 2) | |
printf("%s:\n", argv[i]); | |
for (j = 0, l = strlen(argv[i]); j < l; ++j) | |
printf("%c => %d\n", argv[i][j], argv[i][j]); | |
putchar('\n'); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment