   fread() reads less than fwrites() writes???
  //here fwrite writes 2048 bytesif((stream = sys_fopen(pFullName,TEXT("w+b")))){fwrite(pName,sizeof(wchar_t),2048,stream);}.....//then fread only reads 1748 bytes, and the rest is corrupted.if((stream = sys_fopen(pFullName,TEXT("r+b")))){fread(pName,sizeof(wchar_t),2048,stream);}...end code...feof() returns a 16 when this happens. Anything other than zero means it hit end of file, but why, and what does 16 mean.ferror() returns a 0 when this happens.sometimes it reads 2048 bytes, sometime it only reads 1748 bytes.Has anyone else encountered this problem?"rb", and "wb" also have the same problem.Help anyone!   
  Did you close the file after you wrote to it?   ;  or more specifically, run any operation that flushes the file? (fflush(), fclose())Does your file manager say the file is in fact 2048 bytes?;  yes there was a fclose between the two fopens.I dont use fflushand yes, the file on disk was 2048.;  Isn't sizeof(wchar_t) either 2 or 4 depending on your system?Tryfwrite/read(pName,1,2048,stream);if you're sure that the stream really is 2048 bytes, rather than unicode characters, long.;  Could you try to reduce the code to a 15-line program that shows the problem? If we can reproduce the problem ourselves we can be sure that we have seen all the relevant code.   ;  What is sys_fopen, and why are you passing it a Unicode string for the file mode?   