c++ - X-platform reentrant wcstok()? -
right i'm looking reentrant version of wcstok()
known gcc , other compilers (if there's any).
so far use wcstok_s()
1 msvc , need compile code on other platforms well. while pages suggest wcstok_r()
couldn't find in gcc headers. other (man)pages mention strtok_s()
without specific wide char version mention it's said used for multibyte strings only(?).
so, i'm open suggestions. writing own wrapper/version last way out solution only.
edit aschepler: sample code doesn't compile due too many arguments
- should compile despite being pointless:
#include <cwchar> // includes wchar.h int main(void) { wchar_t *a, *b, *c; wcstok(a, b, &c); return 0; }
the function wcstok
specified c89 (and therefore c++) reentrant , has same signature , same behavior microsoft's wcstok_s
. wcstok
should declared in <wchar.h>
and/or <cwchar>
.
wchar_t* wcstok(wchar_t* s, const wchar_t* delim, wchar_t** ptr);
but looks microsoft's wcstok
has incorrect signature.
so maybe can use #ifdef _windows
(rather #ifdef _msc_ver
) determine function use, if run problem using gcc on windows.
Comments
Post a Comment