Trouble with wcstok()

guru_narayan guru_narayan@hotpop.com
Fri Nov 26 06:11:00 GMT 1999


Dear Sir,

We have been having problems using the function wcstok() on RedHat Linux 6.1
and earlier versions.

Any basic implementation of this function gives a Segmentation fault
The following code is an example:

----------------------------------------------------------------------------
---------------

#include <wchar.h>

main()
{

wchar_t *str = L"Alxphaxbet";
wchar_t * delim = L"x";
wchar_t **ptr;

wchar_t *token;

token = wcstok(str,delim,&ptr);
printf ("The token is %ls", token);
}

----------------------------------------------------------------------------
-------


This code will compile with egcs 1.1.2 but will only end up giving a
Segmentation fault. And gdb indicates an error with wcstok.c in the library.

Also, please note that this function works fine on Solaris 2.6 on earlier
versions of the GNU C Compiler where the function is defined with only two
parameters (str & delim).

We would greatly appreciate a quick solution or any pointer to get a
solution to this problem as we are time bound on certain projects which
depend on this function.

Thanking you in advance,

yours sincerely,

Arman Fazli






More information about the Gcc-bugs mailing list