title: Parsing markdown with C discount library
body: <p>I'm writing a markdown editor (C++/Qt) and i'm using discount library for that purpose.</p>
  
  <p>Documentation: <a href="http://www.pell.portland.or.us/~orc/Code/discount/" rel="nofollow">http://www.pell.portland.or.us/~orc/Code/discount/</a></p>
  
  <p>i wrote that code to convert HTML to markdown.</p>
  
  <pre><code>#include &lt;mkdio.h&gt;
  #include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  int main()
  {
      FILE *out;
      out = fopen("/home/abdeljalil/test.html","w");
      const char* mkdown= "__hello__";
      MMIOT *doc;
      int flags = MKD_TOC|MKD_SAFELINK|MKD_EXTRA_FOOTNOTE;
      doc = mkd_string(mkdown,strlen(mkdown),flags);
      mkd_compile(doc,flags);
      mkd_generatehtml(doc,out);
      mkd_cleanup(doc);
  }
  </code></pre>
  
  <p>is using output file an efficient method? (i will update the GUI every time markdown is changed in the editor)
  can i write HTML directly to a string instead of file? (can't find such function)
  is there any other notes to optimize the code?</p>