I am working on the visual studio c++ and using these lines in my program. Whenever i typed Get status , output is not "Good". the output will always be "invalid command" independent of Cstring strText . first two conditions are not working .

Kindly help . It should be worked according to the input strText.

         if ( strText == _T("Get status") )

         else if ( strText == _T("change") )
             MessageBox(_T("Invalid Command")); 


CString::operator== performs an exact case-sensitive match. If there's a mismatch in case or whitespace, then the strings will compare differently. I can't tell what's the problem in your case. Perhaps you could add L"[" + strText + L"]" to your messagebox, to see if there's some whitespace you overlooked.

In fact, even though CString claims to support Unicode, it doesn't. Two Unicode strigns that are formally identical, but differ in normalization are considered distinct. L"ë" may not be equal to L"ë", according to CString if one is normalized and the other isn't. Windows has the CompareStringEx API, which is the swiss-army-knife of string comparisions and can deal with such details.

Need Your Help

How do I launch an executable without opening Terminal?

osx applescript

I've written a simple command-line executable file, and am trying to make it launch whenever I open its enclosing folder. I'm using a folder action that opens an AppleScript. So far, the AppleScrip...

C# Check if a string is of type ABC123

c# visual-studio-2010

I want to check if a string is of type ABC123.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.