#include<stdio.h>
#include<fcntl.h>
int
main()
{
//计算图片大小
int fd = open("n18.gif", O_RDONLY);
long fsize = lseek(fd, 0L, SEEK_END);
char byteSize[fsize];
FILE *fp;
//将图片转化为数组
fp = fopen("n18.gif", "rb");
fread(byteSize, 1, fsize, fp);
fclose(fp);
close(fd);
//printf("%ld\n", fsize);
//printf("%ld\n",sizeof(byteSize));
//printf("%c\n",byteSize[0]);
//将数组转化为图片
fd = open("n19.gif", O_WRONLY|O_CREAT);
write(fd, byteSize,sizeof(byteSize));
close(fd);
return 0;
}
|