user2188453
user2188453

Reputation: 1145

How is unicode or any other coding data stored in memory? (win32)

Sorry for this amateurish question, I want to do some search and comparisions within an unicode string.

I am a little bit confused about unicode-16/wchar_t, in windows OS, does this stored the same way as an array of uint16?

I mean if I can use it this way without any trouble?

wchar_t a[100]; 
somefunction((uint16 *)a);
//treat a as an array of uint16 data and do something with it.

Upvotes: 0

Views: 214

Answers (1)

RichieHindle
RichieHindle

Reputation: 281355

Yes, it's an array of wchar_t, which is a uint16_t. It's also (usually) NUL-terminated, meaning there's a zero-valued wchar_t at the end of the string.

Upvotes: 3

Related Questions