OK, I've been banging my head over what appears to be some weird behavior in the CRT under VS2008 (debug mode). Here's the code:
Code:
const time_t timeStamp = 1223939307;
char qs[256] = { 0 };
int actualLen = sprintf_s(qs, sizeof(qs), "%lu----%s---", timeStamp, "rukiddingme?");
Yields (in the debugger):
Code:
qs = 0x0012e998 "1223939307----(null)---"
It seems if I put that timestamp in an _snprintf, sprintf, or sprintf_s, the string which follows ends up (null) in the resulting string.
Can anyone verify this? Have I lost the ability to use sprintf over the weekend? It really was totally not wild, although I was dealing with Vista at one point...
Visual Studio 2008 on XP Professional
Compilation command line:
Code:
/Od /I "..\openssl\include" /I "..\ShareFiles\C"
/I "C:\Program Files\Microsoft SDKs\Windows\v6.0A\\Include"
/D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_USRDLL" /D "HELPER_EXPORTS"
/D "_CRT_SECURE_NO_WARNINGS" /D "_VC80_UPGRADE=0x0710" /D "_WINDLL"
/D "_MBCS" /Gm /EHsc /RTC1 /MTd /Fo"Debug\\" /Fd"Debug\vc90.pdb"
/W3 /c /ZI /TP .\utils.cpp
Link command line:
Code:
/OUT:"..\BuildFiles/Helper.dll" /INCREMENTAL /DLL
/MANIFEST /MANIFESTFILE:"Debug\IHelper.dll.intermediate.manifest"
/MANIFESTUAC:"level='asInvoker' uiAccess='false'"
/DEF:"Helper.def" /DEBUG /PDB:"..\BuildFiles/Helper.pdb"
/SUBSYSTEM:WINDOWS /DYNAMICBASE:NO
/IMPLIB:"..\BuildFiles/Helper.lib"
/MACHINE:X86 "C:\Program Files\Microsoft SDKs\Windows\v6.0A\\Lib\winhttp.lib"
..\openssl\lib\libeay32.lib ..\openssl\lib\ssleay32.lib
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib
advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib
Thanks!