Vincent Fatica
2010-06-01 17:18:45 UTC
#include <windows.h>
#include <stdio.h>
INT wmain ( INT argc, WCHAR **argv )
{
WCHAR szFile[MAX_PATH] = L"\"";
wsprintf(szFile + 1 + GetTempPath(MAX_PATH, szFile + 1), L"foobar.txt\"");
wprintf(L"%s\n", szFile);
return 0;
}
When I build the above (/MT, /MTd, VC9) it prints the correct string and then
crashes. The debug version attributes the crash to stack corruption near
szFile. What's up with that? Thanks.
#include <stdio.h>
INT wmain ( INT argc, WCHAR **argv )
{
WCHAR szFile[MAX_PATH] = L"\"";
wsprintf(szFile + 1 + GetTempPath(MAX_PATH, szFile + 1), L"foobar.txt\"");
wprintf(L"%s\n", szFile);
return 0;
}
When I build the above (/MT, /MTd, VC9) it prints the correct string and then
crashes. The debug version attributes the crash to stack corruption near
szFile. What's up with that? Thanks.
--
- Vince
- Vince