Compilation problem....

I am getting the following compile error:

C:\Working\jnli\ocx\Jnli_ocxCtl.cpp(284) : error C2664: 'NLGetVariable' : cannot convert parameter 1 from 'class CString' to 'unsigned short ** '
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called

The offending code is:

BSTR CJnli_ocxCtrl::NLGetVariable(BSTR FAR* variableName)
      CString variable = *variableName;
      CString foo = NLGetVariable(variable);
      return foo.AllocSysString();

And the problem pointer points to line "CSTring foo = NLGetVariable(variable);"

The NLGetVariable to the right of the “=” in that line is pointing to an included dll, and the function in that dll is defined as:

const char* NLGetVariable(const char* variableName)
      _bstr_t result = parsers[0]->getVariable(_bstr_t(variableName));
      const char* buff = (const char*) result;
      return stringCopy(buff);

Any quick ideas?
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.

Use the CString::GetBuffer() method to access the character buffer of the CString variable.  Modify your line that says
    CString foo = NLGetVariable(variable);

so that it instead says
    CString foo = NLGetVariable(variable->GetBuffer());

You should be able to pass this into NLGetVariable in this way, if it gives you trouble you can define a const char* and set it equal to variable->GetBuffer() and then pass the const char* in.

Hope it helps.

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
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.