title: when i try to add a file to another file weird symbols appear?
body: <p>when appending a file to another weird symbols appear at the end and it's ascii is -1, and if there another way to add a file to the other please share</p>
  
  <pre><code>void AddFile(char old_name[],char old_content[]) {
      ofstream old_file;
      ifstream new_file;
      char new_name[255];
      int len, f_begin, f_end;
      cout &lt;&lt; "Enter the file name: ";
      cin.ignore();
      cin.getline(new_name,255,'\n');
      strcat(new_name, ".txt");
      new_file.open(new_name);
      f_begin = new_file.tellg();
      new_file.seekg(0,ios::end);
      f_end = new_file.tellg();
      new_file.seekg(0);
      len = f_end - f_begin;
      char new_content[len+1];
      new_content[len] = '\0';
      for (int i=0; i&lt; len; ++i) {
          new_content[i] = new_file.get();
      }
      new_file.close();
      strcat(old_content,"\n");
      strcat(old_content,new_content);
      old_file.open(old_name);
      cout &lt;&lt; old_content;
      old_file &lt;&lt; old_content;
      old_file.close();
  }
  </code></pre>
  
  <p>the .tellg() function gives the correct size</p>