输入一个字符串输出ASCII的十六进制值
#include <stdio.h> #include <string.h> #define LEN 1024 void main() { char s[LEN] = ""; int i; while(1) { printf("字符串:"); gets(s); printf("输出: \n"); int len = strlen(s); for(i=0; i< len;i++) printf("%02X ",(unsigned char)s[i]); printf("\n--------------------------------------------------------------------------------\n"); } }