I have a C ++ code base that works for a long time. The code base was an outdated set of VS 2003 projects that I recently migrated to VS 2008. The migration seemed to be successful in that the resulting program was built and launched.
I reinstalled my OS and all applications on a new drive, and now when I try to debug the program in the debugger, I get an assertion error inside CRT chsize(really, _chsize_s). In particular (with the base trimmed, excluding security checks):
FILE * testfile = fopen("P:\\_Dan\\local\\foogoo.txt", "w");
int filehandle = fileno(testfile);
chsize(filehandle, 0);
fwrite("goohoo", 1, 6, testfile);
fclose(testfile);
The debug statement is done internally chsize- in particular, in the CRT source code file chsize.c in the following line:
_VALIDATE_CLEAR_OSSERR_RETURN_ERRCODE((_osfile(filedes) & FOPEN), EBADF);
... where filedesappropriate filehandle.
, , - , VS ( VS 2008), VS 8.0 - , , VS 2008. VS 2005 ( 2003). .
.
* - chsize. . .