?
Solved

the "if" function and using with extensions

Posted on 2006-03-19
2
Medium Priority
?
185 Views
Last Modified: 2013-11-20
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.
0
Comment
Question by:didifool213
2 Comments
 
LVL 49

Accepted Solution

by:
DanRollins earned 2000 total points
ID: 16232374
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
 
LVL 1

Author Comment

by:didifool213
ID: 16233252
Thanks!! it works!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question