我收到以下代码错误:
FILE *fp;
int patno;
int h, i, j, l, m;
int i1, i2, i3;
if( (fp=fopen(filename, "r")) == NULL ) {
printf("\"%s\" not found!!\n", filename);
return(-1);
}
for( h=0; h<4; h++ ) {
l = 0;
for( i3 = 0; i3 < 3; i3++ ) {
for( i2 = 0; i2 < PATTERN_HEIGHT; i2++ ) {
for( i1 = 0; i1 < PATTERN_WIDTH; i1++ ) {
if( fscanf(fp, "%d", &j) != 1 ) {
printf("Pattern Data read error!!\n");
return -1;
}
--..rest of code..--
文件存在且路径正确,if(fscanf(fp...)
指针 fp 的值为0x00000000<Bad ptr>..
有任何想法吗?