turning off unicode for a particular block

Posted on 2006-04-26
Last Modified: 2010-04-01
hi all,
  i have a particular block of code that i never want to be unicode. right now i have:

#ifdef _UNICODE

                #undef  _UNICODE
                #define _MBCS

                iStatus = FUNCTION_CALL( m_szFlexLMFeature.GetBuffer(0),
                #undef  _MBCS
                #define _UNICODE

However, this doesn't seem to work. i still get the build error:

error C2664: 'FUNCTION_CALL' : cannot convert parameter 1 from 'unsigned short *' to 'char []'

FUNCTION_CALL is implemented in an external library; all i do is put this prototype in the .h:

extern "C" long WINAPI FUNCTION_CALL( char LMFEATURE[3], char LMVERSION[4], long* LMHANDLE, long* NTOKENS);
Question by:Joe_Banks_217
    LVL 86

    Accepted Solution

    >>FUNCTION_CALL is implemented in an external library; all i do is put this prototype in the .h

    That #undef part won't affect the CString arguments, they're UNICODE anyway. Better convert the arguments to ANSI when you need them, e.g.


    char* szFlexLMFeature = W2A(m_szFlexLMFeature.GetBuffer(0));
    char* szFlexLMVersion = W2A(m_szFlexLMVersion.GetBuffer(0));

                    iStatus = FUNCTION_CALL( szFlexLMFeature,

    See also ("TN059: Using MFC MBCS/Unicode Conversion Macros")

    Author Comment

    Great, thank you jkr

    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    Join & Write a Comment

    Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
    Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
    The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
    The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

    755 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

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now