John,
I do not know what I might be doing wrong, but I cannot compile either of your versions.
Does each version compile for you? ..... If so maybe I need to figure that out.
Here is a complete file that compiles for me if I compile as a Gui, and Console subsystem.
//--------------------------------------------------------------------------------------
#include <windows.h>
#include <tchar.h>
#define strsafe_no_deprecate
#pragma comment (lib, "strsafe.lib")
#include <strsafe.h>
int main()
{
// // ~ • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • •
int const arraysize = 75;
TCHAR pszDest[arraysize];
size_t cchDest = arraysize * sizeof(TCHAR);
LPCTSTR pszFormat = TEXT("%s %s %s %s"); // // ~ NOTE no commas between specifiers !
TCHAR *pszTxt = TEXT("Hello World.");
TCHAR *pszTxt1 = TEXT("I am struggling,");
TCHAR *pszTxt2 = TEXT("with");
TCHAR *pszTxt3 = TEXT("my simple Console App compile.");
StringCchPrintf(pszDest, cchDest, pszFormat, pszTxt, pszTxt1, pszTxt2, pszTxt3);
printf("pszDest is:\n\n\"%s\"", pszDest);
getchar();
return 0;
}
//------------------------------------------------------------------------------------------------
I am using the latest PellesC downloaded setup. w/ Pelle's custom version of the lcc compiler.
I know if your versions compile for you, I need to figure my problem out (but I do get over 100 warnings and errors).
Thanks, Ed