+#endif // defined(wxCRT_Strcoll[AW])
+
+template<typename T>
+inline size_t wxStrspn_String(const wxString& s1, const T& s2)
+{
+ size_t pos = s1.find_first_not_of(s2);
+ return pos == wxString::npos ? s1.length() : pos;
+}
+WX_STR_FUNC(size_t, wxStrspn, wxCRT_StrspnA, wxCRT_StrspnW, wxStrspn_String)
+
+template<typename T>
+inline size_t wxStrcspn_String(const wxString& s1, const T& s2)
+{
+ size_t pos = s1.find_first_of(s2);
+ return pos == wxString::npos ? s1.length() : pos;
+}
+WX_STR_FUNC(size_t, wxStrcspn, wxCRT_StrcspnA, wxCRT_StrcspnW, wxStrcspn_String)
+
+#undef WX_STR_DECL
+#undef WX_STR_CALL
+#define WX_STR_DECL(name, T1, T2) name(T1 s1, T2 s2, size_t n)
+#define WX_STR_CALL(func, a1, a2) func(a1, a2, n)
+
+template<typename T>
+inline int wxStrncmp_String(const wxString& s1, const T& s2, size_t n)
+ { return s1.compare(0, n, s2, 0, n); }
+WX_STRCMP_FUNC(wxStrncmp, wxCRT_StrncmpA, wxCRT_StrncmpW, wxStrncmp_String)
+
+template<typename T>
+inline int wxStrnicmp_String(const wxString& s1, const T& s2, size_t n)
+ { return s1.substr(0, n).CmpNoCase(wxString(s2).substr(0, n)); }
+WX_STRCMP_FUNC(wxStrnicmp, wxCRT_StrnicmpA, wxCRT_StrnicmpW, wxStrnicmp_String)
+
+#undef WX_STR_DECL
+#undef WX_STR_CALL
+#undef WX_STRCMP_FUNC
+#undef WX_STR_FUNC
+#undef WX_STR_FUNC_NO_INVERT
+
+#if defined(wxCRT_StrxfrmA) && defined(wxCRT_StrxfrmW)
+
+inline size_t wxStrxfrm(char *dest, const char *src, size_t n)
+ { return wxCRT_StrxfrmA(dest, src, n); }
+inline size_t wxStrxfrm(wchar_t *dest, const wchar_t *src, size_t n)
+ { return wxCRT_StrxfrmW(dest, src, n); }
+template<typename T>
+inline size_t wxStrxfrm(T *dest, const wxScopedCharTypeBuffer<T>& src, size_t n)
+ { return wxStrxfrm(dest, src.data(), n); }
+inline size_t wxStrxfrm(char *dest, const wxString& src, size_t n)
+ { return wxCRT_StrxfrmA(dest, src.mb_str(), n); }
+inline size_t wxStrxfrm(wchar_t *dest, const wxString& src, size_t n)
+ { return wxCRT_StrxfrmW(dest, src.wc_str(), n); }
+inline size_t wxStrxfrm(char *dest, const wxCStrData& src, size_t n)
+ { return wxCRT_StrxfrmA(dest, src.AsCharBuf(), n); }
+inline size_t wxStrxfrm(wchar_t *dest, const wxCStrData& src, size_t n)
+ { return wxCRT_StrxfrmW(dest, src.AsWCharBuf(), n); }
+
+#endif // defined(wxCRT_Strxfrm[AW])
+
+inline char *wxStrtok(char *str, const char *delim, char **saveptr)
+ { return wxCRT_StrtokA(str, delim, saveptr); }
+inline wchar_t *wxStrtok(wchar_t *str, const wchar_t *delim, wchar_t **saveptr)
+ { return wxCRT_StrtokW(str, delim, saveptr); }
+template<typename T>
+inline T *wxStrtok(T *str, const wxScopedCharTypeBuffer<T>& delim, T **saveptr)
+ { return wxStrtok(str, delim.data(), saveptr); }
+inline char *wxStrtok(char *str, const wxCStrData& delim, char **saveptr)
+ { return wxCRT_StrtokA(str, delim.AsCharBuf(), saveptr); }
+inline wchar_t *wxStrtok(wchar_t *str, const wxCStrData& delim, wchar_t **saveptr)
+ { return wxCRT_StrtokW(str, delim.AsWCharBuf(), saveptr); }
+inline char *wxStrtok(char *str, const wxString& delim, char **saveptr)
+ { return wxCRT_StrtokA(str, delim.mb_str(), saveptr); }
+inline wchar_t *wxStrtok(wchar_t *str, const wxString& delim, wchar_t **saveptr)
+ { return wxCRT_StrtokW(str, delim.wc_str(), saveptr); }
+
+inline const char *wxStrstr(const char *haystack, const char *needle)
+ { return wxCRT_StrstrA(haystack, needle); }
+inline const wchar_t *wxStrstr(const wchar_t *haystack, const wchar_t *needle)
+ { return wxCRT_StrstrW(haystack, needle); }
+inline const char *wxStrstr(const char *haystack, const wxString& needle)
+ { return wxCRT_StrstrA(haystack, needle.mb_str()); }
+inline const wchar_t *wxStrstr(const wchar_t *haystack, const wxString& needle)
+ { return wxCRT_StrstrW(haystack, needle.wc_str()); }
+// these functions return char* pointer into the non-temporary conversion buffer
+// used by c_str()'s implicit conversion to char*, for ANSI build compatibility
+inline const char *wxStrstr(const wxString& haystack, const wxString& needle)
+ { return wxCRT_StrstrA(haystack.c_str(), needle.mb_str()); }
+inline const char *wxStrstr(const wxCStrData& haystack, const wxString& needle)
+ { return wxCRT_StrstrA(haystack, needle.mb_str()); }
+inline const char *wxStrstr(const wxCStrData& haystack, const wxCStrData& needle)
+ { return wxCRT_StrstrA(haystack, needle.AsCharBuf()); }
+// if 'needle' is char/wchar_t, then the same is probably wanted as return value
+inline const char *wxStrstr(const wxString& haystack, const char *needle)
+ { return wxCRT_StrstrA(haystack.c_str(), needle); }
+inline const char *wxStrstr(const wxCStrData& haystack, const char *needle)
+ { return wxCRT_StrstrA(haystack, needle); }
+inline const wchar_t *wxStrstr(const wxString& haystack, const wchar_t *needle)
+ { return wxCRT_StrstrW(haystack.c_str(), needle); }
+inline const wchar_t *wxStrstr(const wxCStrData& haystack, const wchar_t *needle)
+ { return wxCRT_StrstrW(haystack, needle); }
+
+inline const char *wxStrchr(const char *s, char c)
+ { return wxCRT_StrchrA(s, c); }
+inline const wchar_t *wxStrchr(const wchar_t *s, wchar_t c)
+ { return wxCRT_StrchrW(s, c); }
+inline const char *wxStrrchr(const char *s, char c)
+ { return wxCRT_StrrchrA(s, c); }
+inline const wchar_t *wxStrrchr(const wchar_t *s, wchar_t c)
+ { return wxCRT_StrrchrW(s, c); }
+inline const char *wxStrchr(const char *s, const wxUniChar& uc)
+ { char c; return uc.GetAsChar(&c) ? wxCRT_StrchrA(s, c) : NULL; }
+inline const wchar_t *wxStrchr(const wchar_t *s, const wxUniChar& c)
+ { return wxCRT_StrchrW(s, (wchar_t)c); }
+inline const char *wxStrrchr(const char *s, const wxUniChar& uc)
+ { char c; return uc.GetAsChar(&c) ? wxCRT_StrrchrA(s, c) : NULL; }
+inline const wchar_t *wxStrrchr(const wchar_t *s, const wxUniChar& c)
+ { return wxCRT_StrrchrW(s, (wchar_t)c); }
+inline const char *wxStrchr(const char *s, const wxUniCharRef& uc)
+ { char c; return uc.GetAsChar(&c) ? wxCRT_StrchrA(s, c) : NULL; }
+inline const wchar_t *wxStrchr(const wchar_t *s, const wxUniCharRef& c)
+ { return wxCRT_StrchrW(s, (wchar_t)c); }
+inline const char *wxStrrchr(const char *s, const wxUniCharRef& uc)
+ { char c; return uc.GetAsChar(&c) ? wxCRT_StrrchrA(s, c) : NULL; }
+inline const wchar_t *wxStrrchr(const wchar_t *s, const wxUniCharRef& c)
+ { return wxCRT_StrrchrW(s, (wchar_t)c); }
+template<typename T>
+inline const T* wxStrchr(const wxScopedCharTypeBuffer<T>& s, T c)
+ { return wxStrchr(s.data(), c); }
+template<typename T>
+inline const T* wxStrrchr(const wxScopedCharTypeBuffer<T>& s, T c)
+ { return wxStrrchr(s.data(), c); }
+template<typename T>
+inline const T* wxStrchr(const wxScopedCharTypeBuffer<T>& s, const wxUniChar& c)
+ { return wxStrchr(s.data(), (T)c); }
+template<typename T>
+inline const T* wxStrrchr(const wxScopedCharTypeBuffer<T>& s, const wxUniChar& c)
+ { return wxStrrchr(s.data(), (T)c); }
+template<typename T>
+inline const T* wxStrchr(const wxScopedCharTypeBuffer<T>& s, const wxUniCharRef& c)
+ { return wxStrchr(s.data(), (T)c); }
+template<typename T>
+inline const T* wxStrrchr(const wxScopedCharTypeBuffer<T>& s, const wxUniCharRef& c)
+ { return wxStrrchr(s.data(), (T)c); }
+// these functions return char* pointer into the non-temporary conversion buffer
+// used by c_str()'s implicit conversion to char*, for ANSI build compatibility
+inline const char* wxStrchr(const wxString& s, char c)
+ { return wxCRT_StrchrA((const char*)s.c_str(), c); }
+inline const char* wxStrrchr(const wxString& s, char c)
+ { return wxCRT_StrrchrA((const char*)s.c_str(), c); }
+inline const char* wxStrchr(const wxString& s, int c)
+ { return wxCRT_StrchrA((const char*)s.c_str(), c); }
+inline const char* wxStrrchr(const wxString& s, int c)
+ { return wxCRT_StrrchrA((const char*)s.c_str(), c); }
+inline const char* wxStrchr(const wxString& s, const wxUniChar& uc)
+ { char c; return uc.GetAsChar(&c) ? wxCRT_StrchrA(s.c_str(), c) : NULL; }
+inline const char* wxStrrchr(const wxString& s, const wxUniChar& uc)
+ { char c; return uc.GetAsChar(&c) ? wxCRT_StrrchrA(s.c_str(), c) : NULL; }
+inline const char* wxStrchr(const wxString& s, const wxUniCharRef& uc)
+ { char c; return uc.GetAsChar(&c) ? wxCRT_StrchrA(s.c_str(), c) : NULL; }
+inline const char* wxStrrchr(const wxString& s, const wxUniCharRef& uc)
+ { char c; return uc.GetAsChar(&c) ? wxCRT_StrrchrA(s.c_str(), c) : NULL; }
+inline const wchar_t* wxStrchr(const wxString& s, wchar_t c)
+ { return wxCRT_StrchrW((const wchar_t*)s.c_str(), c); }
+inline const wchar_t* wxStrrchr(const wxString& s, wchar_t c)
+ { return wxCRT_StrrchrW((const wchar_t*)s.c_str(), c); }
+inline const char* wxStrchr(const wxCStrData& s, char c)
+ { return wxCRT_StrchrA(s.AsChar(), c); }
+inline const char* wxStrrchr(const wxCStrData& s, char c)
+ { return wxCRT_StrrchrA(s.AsChar(), c); }
+inline const char* wxStrchr(const wxCStrData& s, int c)
+ { return wxCRT_StrchrA(s.AsChar(), c); }
+inline const char* wxStrrchr(const wxCStrData& s, int c)
+ { return wxCRT_StrrchrA(s.AsChar(), c); }
+inline const char* wxStrchr(const wxCStrData& s, const wxUniChar& uc)
+ { char c; return uc.GetAsChar(&c) ? wxCRT_StrchrA(s, c) : NULL; }
+inline const char* wxStrrchr(const wxCStrData& s, const wxUniChar& uc)
+ { char c; return uc.GetAsChar(&c) ? wxCRT_StrrchrA(s, c) : NULL; }
+inline const char* wxStrchr(const wxCStrData& s, const wxUniCharRef& uc)
+ { char c; return uc.GetAsChar(&c) ? wxCRT_StrchrA(s, c) : NULL; }
+inline const char* wxStrrchr(const wxCStrData& s, const wxUniCharRef& uc)
+ { char c; return uc.GetAsChar(&c) ? wxCRT_StrrchrA(s, c) : NULL; }
+inline const wchar_t* wxStrchr(const wxCStrData& s, wchar_t c)
+ { return wxCRT_StrchrW(s.AsWChar(), c); }
+inline const wchar_t* wxStrrchr(const wxCStrData& s, wchar_t c)
+ { return wxCRT_StrrchrW(s.AsWChar(), c); }
+
+inline const char *wxStrpbrk(const char *s, const char *accept)
+ { return wxCRT_StrpbrkA(s, accept); }
+inline const wchar_t *wxStrpbrk(const wchar_t *s, const wchar_t *accept)
+ { return wxCRT_StrpbrkW(s, accept); }
+inline const char *wxStrpbrk(const char *s, const wxString& accept)
+ { return wxCRT_StrpbrkA(s, accept.mb_str()); }
+inline const char *wxStrpbrk(const char *s, const wxCStrData& accept)
+ { return wxCRT_StrpbrkA(s, accept.AsCharBuf()); }
+inline const wchar_t *wxStrpbrk(const wchar_t *s, const wxString& accept)
+ { return wxCRT_StrpbrkW(s, accept.wc_str()); }
+inline const wchar_t *wxStrpbrk(const wchar_t *s, const wxCStrData& accept)
+ { return wxCRT_StrpbrkW(s, accept.AsWCharBuf()); }
+inline const char *wxStrpbrk(const wxString& s, const wxString& accept)
+ { return wxCRT_StrpbrkA(s.c_str(), accept.mb_str()); }
+inline const char *wxStrpbrk(const wxString& s, const char *accept)
+ { return wxCRT_StrpbrkA(s.c_str(), accept); }
+inline const wchar_t *wxStrpbrk(const wxString& s, const wchar_t *accept)
+ { return wxCRT_StrpbrkW(s.wc_str(), accept); }
+inline const char *wxStrpbrk(const wxString& s, const wxCStrData& accept)
+ { return wxCRT_StrpbrkA(s.c_str(), accept.AsCharBuf()); }
+inline const char *wxStrpbrk(const wxCStrData& s, const wxString& accept)
+ { return wxCRT_StrpbrkA(s.AsChar(), accept.mb_str()); }
+inline const char *wxStrpbrk(const wxCStrData& s, const char *accept)
+ { return wxCRT_StrpbrkA(s.AsChar(), accept); }
+inline const wchar_t *wxStrpbrk(const wxCStrData& s, const wchar_t *accept)
+ { return wxCRT_StrpbrkW(s.AsWChar(), accept); }
+inline const char *wxStrpbrk(const wxCStrData& s, const wxCStrData& accept)
+ { return wxCRT_StrpbrkA(s.AsChar(), accept.AsCharBuf()); }
+template <typename S, typename T>
+inline const T *wxStrpbrk(const S& s, const wxScopedCharTypeBuffer<T>& accept)
+ { return wxStrpbrk(s, accept.data()); }
+
+
+/* inlined non-const versions */
+template <typename T>
+inline char *wxStrstr(char *haystack, T needle)
+ { return const_cast<char*>(wxStrstr(const_cast<const char*>(haystack), needle)); }
+template <typename T>
+inline wchar_t *wxStrstr(wchar_t *haystack, T needle)
+ { return const_cast<wchar_t*>(wxStrstr(const_cast<const wchar_t*>(haystack), needle)); }
+
+template <typename T>
+inline char * wxStrchr(char *s, T c)
+ { return const_cast<char*>(wxStrchr(const_cast<const char*>(s), c)); }
+template <typename T>
+inline wchar_t * wxStrchr(wchar_t *s, T c)
+ { return (wchar_t *)wxStrchr((const wchar_t *)s, c); }
+template <typename T>
+inline char * wxStrrchr(char *s, T c)
+ { return const_cast<char*>(wxStrrchr(const_cast<const char*>(s), c)); }
+template <typename T>
+inline wchar_t * wxStrrchr(wchar_t *s, T c)
+ { return const_cast<wchar_t*>(wxStrrchr(const_cast<const wchar_t*>(s), c)); }
+
+template <typename T>
+inline char * wxStrpbrk(char *s, T accept)
+ { return const_cast<char*>(wxStrpbrk(const_cast<const char*>(s), accept)); }
+template <typename T>
+inline wchar_t * wxStrpbrk(wchar_t *s, T accept)
+ { return const_cast<wchar_t*>(wxStrpbrk(const_cast<const wchar_t*>(s), accept)); }
+
+
+// ----------------------------------------------------------------------------
+// stdio.h functions
+// ----------------------------------------------------------------------------
+
+// NB: using fn_str() for mode is a hack to get the same type (char*/wchar_t*)
+// as needed, the conversion itself doesn't matter, it's ASCII
+inline FILE *wxFopen(const wxString& path, const wxString& mode)
+ { return wxCRT_Fopen(path.fn_str(), mode.fn_str()); }
+inline FILE *wxFreopen(const wxString& path, const wxString& mode, FILE *stream)
+ { return wxCRT_Freopen(path.fn_str(), mode.fn_str(), stream); }
+inline int wxRemove(const wxString& path)
+ { return wxCRT_Remove(path.fn_str()); }
+inline int wxRename(const wxString& oldpath, const wxString& newpath)
+ { return wxCRT_Rename(oldpath.fn_str(), newpath.fn_str()); }
+
+extern WXDLLIMPEXP_BASE int wxPuts(const wxString& s);
+extern WXDLLIMPEXP_BASE int wxFputs(const wxString& s, FILE *stream);
+extern WXDLLIMPEXP_BASE void wxPerror(const wxString& s);
+
+extern WXDLLIMPEXP_BASE int wxFputc(const wxUniChar& c, FILE *stream);
+
+#define wxPutc(c, stream) wxFputc(c, stream)
+#define wxPutchar(c) wxFputc(c, stdout)
+#define wxFputchar(c) wxPutchar(c)
+
+// NB: We only provide ANSI version of fgets() because fgetws() interprets the
+// stream according to current locale, which is rarely what is desired.
+inline char *wxFgets(char *s, int size, FILE *stream)
+ { return wxCRT_FgetsA(s, size, stream); }
+// This version calls ANSI version and converts the string using wxConvLibc
+extern WXDLLIMPEXP_BASE wchar_t *wxFgets(wchar_t *s, int size, FILE *stream);
+
+#define wxGets(s) wxGets_is_insecure_and_dangerous_use_wxFgets_instead
+
+// NB: We only provide ANSI versions of this for the same reasons as in the
+// case of wxFgets() above
+inline int wxFgetc(FILE *stream) { return wxCRT_FgetcA(stream); }
+inline int wxUngetc(int c, FILE *stream) { return wxCRT_UngetcA(c, stream); }
+
+#define wxGetc(stream) wxFgetc(stream)
+#define wxGetchar() wxFgetc(stdin)
+#define wxFgetchar() wxGetchar()
+
+// ----------------------------------------------------------------------------
+// stdlib.h functions
+// ----------------------------------------------------------------------------
+
+#ifdef wxCRT_AtoiW
+inline int wxAtoi(const wxString& str) { return wxCRT_AtoiW(str.wc_str()); }
+#else
+inline int wxAtoi(const wxString& str) { return wxCRT_AtoiA(str.mb_str()); }
+#endif