[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Multipurpose binaries with different names
From: |
Tor Lillqvist |
Subject: |
Re: Multipurpose binaries with different names |
Date: |
Wed, 29 Jul 2009 09:13:20 +0300 |
> #ifdef _WIN32
> executable_name = strrchr (argv[0], '\\');
Bzzt. You have to use the multi-byte character set aware _mbschr() and
_mbsrchr() functions from <mbchar.h> to search for backlashes (or
slashes) in "narrow" (char *) system code page strings (for instance,
file names) on Windows. The East Asian double-byte code pages have
two-byte characters where the second byte is backslash or slash.
Alternatively, use the Unicode (wide character) APIs and wchar_t
variables and pointers. That makes it harder to share the same code
snippets between Unix and Windows, though.
--tml