void far *Buffer ; unsigned char *I ; //Note I is different than Buffer unsigned char **arr; //read from file fread((void *)Buffer, (size_t)1, (size_t)ImageSize, file_ptr); //Make I Point to same as Buffer I=(unsigned char *)Buffer // now from I, fetch it in arr. // first allocate memory to arr. for(i=0;i<rows;i++) { arr[i]=(unsigned char *)malloc(cols*sizeof(unsigned char)); } for(i=0;i<rows;i++) { for(j=0;j<cols;j++) { arr[i][j]=*(I+i*Iw+j); } }