How can i use a static L"string" as a parameter in a C function?

Started by JohnClaw, June 04, 2024, 09:14:02 AM

Previous topic - Next topic

JohnClaw

I have some problems with this subject. For example, i has Test.dll, Test.lib and Test.h. So when i try to call C function declared in Test.h: TestFunction(L"info") BCX translates it's code to C like this: TestFunction(L "info"). So BCX adds a space after L and it makes compilation to fail. How can i fix that? Help me, please.

MrBcx

You have several options.  Here are two common ones:

1) use the built-in BCX ANSITOWIDE function:

TestFunction (ANSITOWIDE("info"))

2)  Treat it as a C statement by using the BCX exclamation point operator.

! TestFunction(L"info");


JohnClaw

Thank you very much, MrBcx. Now my code compiles without errors.