By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,227 Members | 1,376 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,227 IT Pros & Developers. It's quick & easy.

String macro as wchar_t pointer?

P: n/a
Hi!

#define TEST "this is a test"
const char * test = TEST;
const wchar_t * wtest = ???;

What must I write, to get TEST evaluated to L"this is a test" at compile
time?
Heiner
h.********@nospam.gmx.de
Remove the nospam to get my real address
Jun 23 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a


Heiner wrote On 06/23/06 17:15,:
Hi!

#define TEST "this is a test"
const char * test = TEST;
const wchar_t * wtest = ???;

What must I write, to get TEST evaluated to L"this is a test" at compile
time?


const wchar_t * wtest = L"" TEST;

.... taking advantage of string literal concatenation:
When a wide-string literal L"" is concatenated with a
char-string literal, the result is wide.

--
Er*********@sun.com

Jun 23 '06 #2

P: n/a
On Fri, 23 Jun 2006 18:18:50 -0400, Eric Sosman wrote:
const wchar_t * wtest = L"" TEST;

... taking advantage of string literal concatenation:
When a wide-string literal L"" is concatenated with a
char-string literal, the result is wide.


That's it. Thank you very much!

Heiner
Jun 23 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.