Separating null byte separated UNICODE C string.

Posted by Ramblingwood on Stack Overflow See other posts from Stack Overflow or by Ramblingwood
Published on 2010-04-11T01:41:03Z Indexed on 2010/04/11 1:43 UTC
Read the original article Hit count: 269

Filed under:
|
|
|

First off, this is NOT a duplicate of: http://stackoverflow.com/questions/1911053/turn-a-c-string-with-null-bytes-into-a-char-array , because the given answer doesn't work when the char *'s are Unicode.

I think the problem is that because I am trying to use Unicode and thus wchar_t instead of char, the length of each character is different and thus, this doesn't work (it does in non-unicode):

char *Buffer;             // your null-separated strings
char *Current;            // Pointer to the current string
// [...]
for (Current = Buffer; *Current; Current += strlen(Current) + 1)
  printf("GetOpenFileName returned: %s\n", Current);

Does anyone have a similar solution that works on Unicode strings?

I have been banging my head on the this for over 4 hours now. C doesn't agree with me.

© Stack Overflow or respective owner

Related posts about c

    Related posts about win32