I'm trying to read a wide char from a stream that was created using fmemopen with a char *.
char *s = "foo bar foo";
FILE *f = fmemopen(s,strlen(s),"r");
wchar_t c = getwc(f);
getwc throws a segmentation fault, I checked using GDB.
I know this is due to opening the stream with fmemopen, because calling getwc on a stream opened normally works fine.
Is there a wide char version of fmemopen, or is there some other way to fix this problem?