title: How can a .txt file be converted to binary file (.dat) with C++ and fstream?
body: <p>I'm trying to write a simple program to test user efficiency with a keyboard (just words per minute and accuracy for now) but I'm having difficulty with the file manipulation part. I want to have a list of words stored in a .txt file (for easy editing) like this:</p>
  
  <pre><code>    cheese
      computer
      photograph
      download
      etc...
  </code></pre>
  
  <p>I want to be able to convert the .txt file as a whole into a binary file, with each word going into an entry in the .dat file, but I'm having a hard time figuring out how fstream reads data from a .txt file. What would be the easiest way to read the words from the list with fstream so that they can be added to entries in a binary file?</p>