Do I do it like:

wchar_t *str = L"12345";

because that doesn't seem to be working.

Aia commented: This post doesn't seems to be working, neither. -3

Recommended Answers

Do you have a decent definition of "doesn't seem to be working"?

Nothing is printed?
Something is printed?
Your disk has been reformatted?

Jump to Post

Might I suggest "%ls" instead of "%s"?

Jump to Post

All 6 Replies

Do you have a decent definition of "doesn't seem to be working"?

Nothing is printed?
Something is printed?
Your disk has been reformatted?

commented: thanks for the morning chuckle +9

Do you have a decent definition of "doesn't seem to be working"?

Nothing is printed?
Something is printed?
Your disk has been reformatted?

Sorry,

When using the L"str" as an argument to a function, it only gives the first character of the string (ie, 's')

Also, the following snippet prints nothing:

wprintf(L"%s\n", L"string");

Might I suggest "%ls" instead of "%s"?

Oops I found what the problem is. The function expects ucs2 and wchar_t is ucs4.

I'm about to mark this as solved, but does anybody have any idea how to get around this (give the function what it wants)?

Now when you say "gcc", are we assuming Linux, or one of the windows ports like MinGW or DJGPP (or others?)

It's linux; ubuntu jaunty

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.