turning off unicode for a particular block

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);
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

>>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 http://msdn.microsoft.com/library/en-us/vclib/html/_mfcnotes_tn059.asp ("TN059: Using MFC MBCS/Unicode Conversion Macros")

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Joe_Banks_217Author Commented:
Great, thank you jkr
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

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.