The output of this example is …
HC:\Projects\cppexample.exeello world.
Why the path to the current executable was pushed in the string?
#ifndef UNICODE
#define UNICODE
#endif
#include <Windows.h>
int main()
{
TCHAR string[255];
string[0]=TEXT('H');
wcscat(string,TEXT("ello world"));
MessageBox(0,string,0,0);
system("Pause");
return 0;
}
Because you did not end the “string” “H” with a null-byte. Therefore
wcscatappends to where it finds the first null-byte in your (uninitialized) array, which happened to contain the executable path (and one byte of something else before that).