Possible Duplicate:
Compare std::wstring and std::string
I have silly question. I know I can use L prefix before a string to use it as wchar_t* (for unicode strings) but I dont know how to use this prefix before variable. I mean
std::wstring str = L"hello";
I know the code above, but how about this one:
string somefunction();
std::wstring str1 = L(somfunction())
this say that 'L' identifier not found
the problem is how to apply L prefix to unquoted string?
void wordNet::extractWordIds(wstring targetWord)
{
pugi::xml_document doc;
std::ifstream stream("words0.xml");
pugi::xml_parse_result result = doc.load(stream);
pugi::xml_node words = doc.child("Words");
for (pugi::xml_node_iterator it = words.begin(); it != words.end(); ++it)
{
std::string wordValue = as_utf8(it->child("WORDVALUE").child_value());
std::wstring result (wordValue.size (), L' ');
std::copy (wordValue.begin (), wordValue.end (), result.begin ());
if(!result.compare(targetWord))
cout << "found!" << endl;
}
}
actully I want to compare targetWord with wordValue. you see that I convert wordValue to wstring but still dont get the right result by comparision.