in fread and fwrite the first parameter is "void *" so try typecasting the first parameter as following fread((void*)b,sizeof(dtype),bigVal,fp); fwrite((void*)b,sizeof(dtype),bigVal,fp); it worked when i tried past.:) FAILURE is the first step towards SUCCESS