How do I convert an mxArray of mxChar to a UTF-8 C-string in C code?

How do I convert an mxArray of mxChar to a UTF-8 C-string in C code?

 Accepted Answer

Use the 'mxArrayToUTF8String' function. It handles multiple rows the same way as 'mxArrayToString'.
 

1 Comment

CAUTION: If mxArrayToUTF8String behaves the same way as mxArrayToString as I suspect, then the memory behind this allocation is NOT on the garbage collection list. So you as the programmer must manually free it or you will have a permanent memory leak.

Sign in to comment.

More Answers (0)

Categories

Products

Release

R2016b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!