I used fread to read .bmp image file into buffer based on code below:
//Open an Image File pImageFile = fopen("D:\\SampleBitMap.bmp","rb"); //Get Image File Size fseek(pImageFile,0,SEEK_END); lSize =ftell(pImageFile); rewind(pImageFile); //Allocate memory to buffer bytevalue = (char*) malloc (sizeof(char)*lSize); fread(bytevalue,1,lSize,pImageFile); printf("bytevalue is %s \n",bytevalue);
no matter how many byte size per element or how many elements I set, the bytevalue is always equal to BM^ò
Is there anything wrong with my code?
Jason