title: C programming with iconv lib in Linux
body: <p>This is my code:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  #include &lt;iconv.h&gt;
  
  int main()
  {
      char input[BUFSIZ];
      char output[BUFSIZ];
      size_t insize = BUFSIZ;
      size_t outsize = BUFSIZ;
  
      char **inp = (char **)input;
      char **outp = (char **)output;
  
      iconv_t cd = iconv_open("gb2312", "utf-8");
  
      memset(input, '\0', sizeof(input));
      memset(output, '\0', sizeof(output));
  //  freopen("input", "r", stdin);
      scanf("%s", input);
      insize = strlen(input);
  
      iconv(cd, inp, &amp;insize, outp, &amp;outsize);
      printf("%s\n", output);
      iconv_close(cd);
      return 0;
  }
  </code></pre>
  
  <p>when I run it, I got this message:</p>
  
  <p><strong>a.out:</strong>
  **gconv.c:75: __gconv: Assertion**
  <strong>`outbuf != ((void *)0) &amp;&amp; *outbuf != ((void *)0)' failed.</strong>
  *<em>已放弃</em>*</p>
  
  <p>I can't found any problem and I feel helpless~ I'm not good at english</p>