LPCTSTR Machine=L"Network\\Value";
char s[100]="Computer\\";
strcat(s,(const char*)Machine);
printf("%s",s);
Here i received output Computer\N only i expect output like Computer\Network\Value . Give Solution for that..
LPCTSTR Machine=L"Network\\Value";
char s[100]="Computer\\";
strcat(s,(const char*)Machine);
printf("%s",s);
Here i received output Computer\N only i expect output like Computer\Network\Value . Give Solution for that..
The string pointed Machine is a unicode string and hence has one NULL character after the character 'N'. So if you use non-unicode string concatanation you will get the output like that. You should not mix the unicode and non-unicode strings like that. You can do it like this:
LPCTSTR Machine=L"Network\\Value";
TCHAR s[100]=_T("Computer\\");
_tcscat(s,Machine);
std::wcout<<s;
You try to cancat an ANSI string with a Unicode string. That won't work. Either make the fisrt string ANSI
LPCSTR Machine="Network\\Value";
or convert the second one with MultiByteToWideChar().