I am writing a code for comparing two strings of type LPSTR and wchar_t type. The contents of strings are same but the output is showing that the strings are different. Below is screenshot of the complete code.
#include <iostream>
#include <string.h>
#include <wtypes.h>
using namespace std;
int main(int argc, char** argv)
{
LPSTR str1= "Abcdef123456";
wchar_t *str2 = L"Abcdef123456";
if(!strcmp((char *)str1, (char *)str2))
{
cout<<"same";
}
else
{
cout<<"diff";
}
return 0;
}
Upon execution, the output is diff. I think the output should be same. Please help.