Re: ANSI C extensions and Unicode

From: Asmus Freytag (
Date: Wed Jan 08 1997 - 00:41:09 EST

At 05:46 PM 1/7/97 -0800,Kevin ehsani wrote:
> I had a couple of questions. If you are convertig your code to unicode or
> compiling under unicode do should you convert '\0' to L'\0' and
> arguments>to fopen such as 'wb' to L'wb'. Is there some where I can
> find out more about unicode compilation rules.

L'<c>' where <c> is a literal character or escape sequence will be converted
by mbtowc into the character set used for wchar_t for your compiler
*this is compiler vendor specific*. (For Windows programmers using
Microsoft's compilers (or compilers compatible with it) L'<c>' would
indeed turn into the Unicode equivalent of <c>.)

fopen ALWAYS expects arguments of type char *, not wchar_t *.
Some compiler vendors (following Microsoft) have created an extension
_ftopen which -does- take wchar_t * arguments. For these environments
the use of L"wb" (notice the ", NOT ' ) with _ftopen does indeed give the
intended result.

Please make sure you consult chapter 5 in Unicode 2.0 as well as your
compiler vendor's runtime library reference. If you don't have a copy of
Unicode 2.0 see http://www/


This archive was generated by hypermail 2.1.2 : Tue Jul 10 2001 - 17:20:33 EDT