输入一个字符串输出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");
    }

}

posted @ 2013-09-04 11:25  Please Call me 小强  阅读(662)  评论(0编辑  收藏  举报