#include <stdio.h>
#include <string.h>
int main(int argc,char *argv[])
{
char *strTest = "hello world";
int strLen=strlen(strTest);
int i=0;
FILE *fp;
if((fp=fopen("text.txt", "wb")) == NULL)
{
printf("file open failed!");
return 0;
}
printf("%d\n",strLen);
while(i<strLen)
{
fprintf(fp,"%02x",strTest[i++]);
}
return 1;
}
如何把数据保存成16进制写入文件
最新推荐文章于 2023-07-29 11:43:35 发布