// for ANSI/UNICODE
#ifdef UNICODE
#define $ L
#else
#define $
#endif /* UNICODE */
// use it
wsprintf($"hello");
Can it work?
Not like that. You might want to see how it's done for the win32 API. Other
than that, wsprintf will never take a char string. And never only one
argument. I assume that was just an ill-chosen example.
No. The way the win32 API works and the way you have to work with it is
pretty fucked up, so I wouldn't redo it. In particular when some piece of
your code suddenly changes meaning depending on a preprocessor definition
it is simply annoying. I only see two good ways for flexible i18n: use
char and switch between different charsets (remember, with UTF-8 you have
full Unicode range available!) via the locale or use wchar_t internally
and only convert accordingly when doing IO.
If you need to really do it like that, you could still write your own
preprocessor or use sed/awk/perl whatever.
Uli