Olga
Olga

Reputation: 49

How to pass string from C# to C++ specifying encoding

I'm writing native C++ library to be used from C#. I need a C++ method receiving string (or char array) and Encoding. Inside this method I want to convert this string to byte array with respect of Encoding, work with it and send back string converted from byte array with respect of Encoding. As far as this method will be called from C#, I can pass System.Text.Encoding to it, but I don't know any analog in C++ for it. What approach would you suggest?

Upvotes: 0

Views: 503

Answers (1)

helb
helb

Reputation: 7773

It would be much simpler to pass the byte array to the C++ library if you're only going to operate on the bytes anyway...

Upvotes: 1

Related Questions