the "if" function and using with extensions

My main motive for my application is to determine the file extension and then move onto that peice of code.I am still prety new to MFC C++ so give me a break if im doing it the hard way!

if(m_ext=="AFS")
{
  AfxBeginThread(ReadAFS, this);
  return;
};

now when i have that function under one of my buttons it is supposd to pass onto another peice of code.but it does work, but if the extension was lower case then it totally screw's up.i have tried to go to my edit box and set the casing to upper and tried lower as well. and still same issue.
my main goal is to not worry bout extension casing.
LVL 1
didifool213Asked:
Who is Participating?
 
DanRollinsCommented:
I'm assuming that m_ext is a Cstring.

There are several ways to compare strings that may have different character cases.  This simplest is to upshift one and compare to the upshifted copy of the other:

        MakeUpper( m_ext );
        if ( m_ext  == "AFS" ) {
                ...etc...
        }

Another way is to use CString::CompareNoCase.  For instace:

        if ( m_ext.CompareNoCase("AFS") == 0 )  {
                ...etc...
        }
0
 
didifool213Author Commented:
Thanks!! it works!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.