1 Star 0 Fork 0

向宇 / 初学之旅:2022大一秋

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
c language309读出二进制编码文件的ASCII0~127所有字符2.0 617 Bytes
一键复制 编辑 原始数据 按行查看 历史
#include<stdio.h>
#include<stdlib.h>
#include<ctype.h>
int main(void)
{
FILE *fp;
char ch;
int i;
if((fp=fopen("demo.bin","wb"))==NULL)
{
printf("Failed to open demo.bin!\n");
exit(0);
}
for(i=0;i<128;i++)
{
fputc(i,fp);
}
fclose(fp);
if((fp=fopen("demo.bin","rb"))==NULL)
{
printf("Failed to open demo.bin!\n");
exit(0);
}
while((ch=fgetc(fp))!=EOF)
{
if(isprint(ch))
printf("%c",ch);
else
printf("%d",ch);
}
fclose(fp);
return 0;
}
C
1
https://gitee.com/X_yugg1/learning-journey.git
git@gitee.com:X_yugg1/learning-journey.git
X_yugg1
learning-journey
初学之旅:2022大一秋
master

搜索帮助