|
-
August 6th, 2009, 06:58 AM
#1
What's wrong with this code?
Hello, I've trouble with this code:
Code:
#ifdef UNICODE
static std::wstring GetConfigDependentString(const std::string& str);
#else
static std::string GetConfigDependentString(const std::string& str);
#endif
...
#ifdef UNICODE
std::wstring CCoreUtils::GetConfigDependentString(const std::string& str)
{
return CCoreUtils::UTF8ToUTF16(str);
}
#else
const std::string CCoreUtils::GetConfigDependentString(const std::string& str)
{
return str;
}
#endif
...
void CCoreUtils::MyFunc(const std::string& dialogTitle)
{
OPENFILENAME ofn;
...
ofn.lpstrTitle = CCoreUtils::GetConfigDependentString(dialogTitle).c_str();
...
}
The project is configured to use the Multi-Byte Character Set (ie. UNICODE is not defined). However, when I call MyFunc(...), in ofn.lpstrTitle there is nonsense after the assignment. How is that possible? The class CCoreUtils is also used in another project built with UNICODE defined, but it gives me nonsense even if I choose Rebuild Solution for this (non-UNICODE) project.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|