C++ newbie here with a quick question. How do I print the contents of CString to the Console?
Doing this
int main(array<System::String ^> ^args)
{
CString cs1 = _T("Hy");
CString cs2 = _T(" u");
CString cs3 = cs1 + cs2;
Console::WriteLine(cs3);
printf("%s", cs3);
return 0;
}
outputs “True” and “H” on the console. TIA.
I’m guessing you’re compiling with Unicode turned on, but
printfis an ANSI function, so it prints only the first character of the string. Use_tprintfto match your_Tstrings: