title: Segmentation Fault on fprintf iofputs.c: No such file or directory
body: <p>I have the following code:</p>
  
  <pre><code>    FILE* fp;
      if(value.empty())
        return ID;
      fp=fopen((tmpDir+"/"+filename).c_str(),"a");
      string sID="";
      if(ID&gt;-1){
        sID=to_string(ID)+"\t";
      }
      string row=sID+drawingID+"\t"+data+"\n";
      fprintf(fp,"%s",row.c_str());
      fclose(fp);
  </code></pre>
  
  <p>Under GDB, the code fails with the following errors:</p>
  
  <pre><code>    Program received signal SIGSEGV, Segmentation fault.
      __GI__IO_fputs (str=0x4a864 "1000001\t0\t70\t1\n", fp=0x0) at iofputs.c:38
      38  iofputs.c: No such file or directory.
  </code></pre>