On 12/21/11 16:49, Kusanagi Kouichi wrote:
+  if (bufsize / size<  count)
+  {
+    _invalid_parameter(NULL, NULL, NULL, 0, 0);
+    fseek(fp, bufsize, SEEK_CUR);
It's not correct to make a seek here. The file position changes you're observing is related to data being read to FILE buffer.

This is also not working in case of small file. invalid_parameter handler should only be invoked if data is to big to fit into the buffer.

+    /* fread_s raises an exeption if a file was opened by fopen */
Probably you did something wrong here. It's allowed to use fread_s and fopen (unless there was a broken version of msvcrt90).
+    /* fclose raises an exception if a file was opened by fopen_s */
This doesn't seem right as well.

+    ret = p__fclose_nolock(file);
It should be easy to add a proper implementation of _fclose_nolock.

Piotr


Reply via email to