我不确定为什么我运行它(使用argv [1]是ppm图像)会导致段错误。有什么想法吗?
unsigned char *image;
char *name;
int sz;
name = argv[1];
FILE *fpt;
fpt = fopen(name,"rb");
fseek(fpt, 0, SEEK_END);
sz = ftell(fpt);
fseek(fpt, 0, SEEK_SET);
image = (unsigned char *) calloc(sz, 1);
fread(image, 1, sz, fpt);