title: Line Breaks when reading an input file by character in C++
body: <p>Ok, just to be up front, this IS homework, but it isn't due for another week, and I'm not entirely sure the final details of the assignment.  Long story short, without knowing what concepts he'll introduce in class, I decided to take a crack at the assignment, but I've run into a problem.  Part of what I need to do for the homework is read individual characters from an input file, and then, given the character's position within its containing word, repeat the character across the screen.  The problem I'm having is, the words in the text file are single words, each on a different line in the file.  Since I'm not sure we'll get to use <code>&lt;string&gt;</code> for this assignment, I was wondering if there is any way to identify the end of the line without using <code>&lt;string&gt;</code>.</p>
  
  <p>Right now, I'm using a simple <code>ifstream fin;</code> to pull the chars out.  I just can't figure out how to get it to recognize the end of one word and the beginning of another.  For the sake of including code, the following is all that I've got so far.  I was hoping it would display some sort of <code>endl</code> character, but it just prints all the words out run together style.</p>
  
  <pre><code>ifstream fin;
  char charIn;
  
  fin.open("Animals.dat");
  fin &gt;&gt; charIn;
  while(!fin.eof()){
      cout &lt;&lt; charIn;
      fin &gt;&gt; charIn;
  }
  </code></pre>
  
  <p>A few things I forgot to include originally:</p>
  
  <p>I must process each character as it is input (my loop to print it out needs to run before I read in the next char and increase my counter).  Also, the length of the words in 'Animals.dat' vary which keeps me from being able to just set a number of iterations.  We also haven't covered fin.get() or .getline() so those are off limits as well.</p>
  
  <p>Honestly, I can't imagine this is impossible, but given the restraints, if it is, I'm not too upset.  I mostly thought it was a fun problem to sit on for a while.</p>