2byte Unicode in KDS3.2  /wchar_t

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

2byte Unicode in KDS3.2  /wchar_t

790 Views
jaroslavbrazdil
Contributor I


Hi,

I want to use 2 byte Unicode in my KDS3.2 / SDK 2.0project .

I have found this : Unicode support in KDS3.0?

 

and I set my compile parametr for GCC    (Properties /  C/C++ Build / Cross ARM C Compiler / Miscellanous / other compiler flags):      -fshort-wchar

 

It can generate 2 byte unicode strings.

Is it possible to use functions from wchar.h   as 

swprintf, (wchar_t *__restrict, size_t,  const wchar_t *__restrict, ...);  ?

 

 

When I try to use

 

  wchar_t buf[20];

  swprintf(buf, 20, L"%ls", L"XAHOJ123456");

 

the buffer buf[20] is set as 2byte,

the functin use buf as 4byte , the buf is overloaded in the swprintf()

and a hard fault error ocure.

 

Have I use other library, or copile the library somehow?

 

 

Thank You,

       Jaroslav

Labels (1)
0 Kudos
2 Replies

599 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi,

from what I know KDS doesn't have other replacement function for swprintf.

I think the only "fix" is to use 4bytes buf for swprintf.


Have a great day,
Jennie Zhang

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

599 Views
jaroslavbrazdil
Contributor I

Hi Jennie,

I am afraid that you are right.

My problem is, that I need to convert existig CW project to KDS.

The project has a lot of code included 2byte strings in Flash, od SDHC card and

on the "other side" of USB. It is not simple to convert all of them.

Best regards

                       Jaroslav

0 Kudos