title: Remove the last new line in C
body: <p>I want to remove the last new line from the following function:</p>
  
  <pre><code>void WriteToFile(node *tree)
  {
      void Write(node*);
      fp = fopen("dictionary.txt","w");
      if(fp==NULL)
      {
          printf("Cannot open file for writing data...");
      }
      else //if(tree==NULL)
      {
          if(tree!=NULL)
          {
              Write(tree);
          }
          fclose(fp);  
      }
  }
  void Write(node *tree)
  {
      if(tree!=NULL)
      {
          fprintf(fp,"%s:%s\n",tree-&gt;word,tree-&gt;meaning);
          Write(tree-&gt;left);
          Write(tree-&gt;right);
      }
  }
  </code></pre>
  
  <p>I am using this function to write to a text file the contents of a BST, and I dont want it to write the last new line, how can I remove it?</p>