sample code:
Code: Select all
unsigned int int_var;
unsigned short int sint_var;
FILE *some_fd = fopen("some_file_that_have_over_2MB","rb");
fread(&sint_var,1,2,some_fd); // this will be ok
fread(&int_var,1,4,some_fd); // this will be ok
fread(&sint_var,1,2,some_fd); // after this ftell function returns 0xffffffff
Code: Select all
fread(((unsigned char*)&sint_var)+0 ,1,1,some_fd);
fread(((unsigned char*)&sint_var)+1 ,1,1,some_fd);
Still I can use two fgetc (I saw this uses fread :) ) or just two times fread for one byte, but this is ugly :).
Have anybody similar issues?