title: Deleting an enter key value at the end of a char array in C++
body: <p>I have a list of names from a text file I want to read in and then output back to another text file. ie:</p>
  
  <pre><code>101 Name 1
  102 Name 2
  103 Name 3
  </code></pre>
  
  <p>And for the code:</p>
  
  <pre><code>int studentID;
  char name[MAX];
  while (infile &gt;&gt; studentID)
        {
          infile.getline (name, MAX);
          outfile &lt;&lt; left &lt;&lt; setw(10) &lt;&lt; studentID;
          outfile &lt;&lt; left &lt;&lt; setw(20) &lt;&lt; name;
          outfile &lt;&lt; left &lt;&lt; setw(10) &lt;&lt; "SKIPPED WORD";
        }
  </code></pre>
  
  <p>It will read in the enter key after the name from the text file, and then it will translate back to an enter key when I want to output it another text file and it will look like this.</p>
  
  <pre><code>101 Name 1
  SKIPPED WORD
  102 Name 2
  SKIPPED WORD
  103 Name 3
  SkIPPED WORD
  </code></pre>
  
  <p>This is what I want</p>
  
  <pre><code>101 Name 1 SKIPPED WORD
  102 Name 2 SKIPPED WORD
  103 Name 3 SKIPPED WORD
  </code></pre>
  
  <p>Anyone knows how I can delete the 'enter' at the end of the char array?</p>