title: Read wide char from a stream created with fmemopen
body: <p>I'm trying to read a wide char from a stream that was created using <code>fmemopen</code> with a <code>char *</code>.</p>
  
  <pre><code>char *s = "foo bar foo";
  FILE *f = fmemopen(s,strlen(s),"r");
  
  wchar_t c = getwc(f);
  </code></pre>
  
  <p><code>getwc</code> throws a segmentation fault, I checked using GDB.</p>
  
  <p>I know this is due to opening the stream with <a href="http://man7.org/linux/man-pages/man3/fmemopen.3.html" rel="noreferrer"><code>fmemopen</code></a>, because calling <code>getwc</code> on a stream opened normally works fine.</p>
  
  <p>Is there a wide char version of <code>fmemopen</code>, or is there some other way to fix this problem?</p>