468,512 Members | 1,457 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,512 developers. It's quick & easy.

Casting an array of unsigned char to wchar_t pointer

4
I have an array of bytes that has data loaded into it. I want to get a wchar_t pointer to the data loaded as unicode characters so I can use unicode string functions. I'm not sure how to do it.

unsigned char n[1000];
// fill array with numeric and unicode text data
wchar_t *test;
test = &n[100]; // this doesn't work
test = &(wchar_t)n[100]; // this doesn't work
test = &((wchar_t)n[100]); // this doesn't work
test = (wchar_t)&n[100]; // this doesn't work

What will work?
Sep 7 '06 #1
2 12539
try this one

t=(wchar_t *) n;
Sep 7 '06 #2
brimp
4
try this one

t=(wchar_t *) n;

Thank you. This worked.
Sep 7 '06 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by drowned | last post: by
4 posts views Thread by David Rager | last post: by
1 post views Thread by wenmang | last post: by
1 post views Thread by Baloff | last post: by
8 posts views Thread by rihad | last post: by
33 posts views Thread by Mark P | last post: by
20 posts views Thread by quantumred | last post: by
11 posts views Thread by jois.de.vivre | last post: by
1 post views Thread by fmendoza | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.