//如何将一个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;
}

相关文章:

  • 2021-08-20
  • 2021-09-07
  • 2022-02-11
  • 2021-06-03
  • 2022-01-10
  • 2021-07-21
  • 2021-06-26
  • 2022-01-04
猜你喜欢
  • 2021-10-27
  • 2021-05-27
  • 2021-08-24
  • 2021-09-05
  • 2021-11-23
  • 2021-09-13
  • 2022-02-08
相关资源
相似解决方案