//如何将一个ASCII码的数据,分解为其两位16进制字符型数据,保存在一个字符数组中
#include <stdio.h>
#include <string.h>
#include <unistd.h>
int http_encode(char c,char *out)
{
int j = 0;
char hex_table[16] = "0123456789abcdef";
out[j] = hex_table[c >> 4];
j++;
out[j] = hex_table[c & 0x0f];
j++;
out[j] = '\0';
return 0;
}
int main()
{
char c;
printf("Please input:");
scanf("%c",&c);
char outurl[10] = "";
http_encode(c,outurl);
printf("*0x%s*\n",outurl);
return 0;
}
LINUX C练习1
原创
©著作权归作者所有:来自51CTO博客作者magic_180的原创作品,请联系作者获取转载授权,否则将追究法律责任
上一篇:java设计模式-装饰模式
下一篇:HTML 自动跳转代码
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
Linux阶段练习(1)
Linux 阶段练习题
Linux 阶段 练习题 -
周中练习1 C
A friend of yours has written a program tha
二分 #include c++ -
C语言结构练习1
1.根据学员的成绩,输出不及格党员的详细信息。#include struct student{ int num; c
语言 c struct float ini