1 Star 0 Fork 0

20155315庄艺霖 / 20155315zyl

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
Myod.c 800 Bytes
一键复制 编辑 原始数据 按行查看 历史
20155315庄艺霖 提交于 2017-10-15 18:55 . w6
#include "head.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc,char** argv)
{
//char filepath[1000];
char *a;
char p;
//printf("%s",argv[1]);
//scanf("%s",filepath);
FILE *fp;
int len;
fp=fopen(argv[1],"rb");//以只读模式打开文件
if(fp==NULL){
printf("open file failed!!\n");
return 0;
}
fseek(fp,0,SEEK_END);//定位文件指针到末尾
len=ftell(fp);//返回当前文件指针与文件头之间的距离
a =(char *)malloc(sizeof(char)*(len+1));//分配文件长度加一大小的内存区
memset(a,0,len+1);//初始化内存区
rewind(fp);//定位文件指针到文件开始位置
fread(a,1,len,fp);//从文件指针当前位置读len长度的内容到a内存区
od(a,len);
}
C
1
https://gitee.com/ZZYYLL/20155315zyl.git
git@gitee.com:ZZYYLL/20155315zyl.git
ZZYYLL
20155315zyl
20155315zyl
master

搜索帮助

53164aa7 5694891 3bd8fe86 5694891