<p>I wanted to use <code>fstream</code> to read a txt file.</p>

<p>I am using <code>inFile &gt;&gt; characterToConvert</code>, but the problem is that this omits any spaces and newline.</p>

<p>I am writing an encryption program so I need to include the spaces and newlines.</p>

<p>What would be the proper way to go about accomplishing this?</p>

The following c++ code will read an entire file...
```
```
#include <iostream>
#include <fstream>
#include <string>
using namespace std;

int main () 
{
  string line;
  ifstream myfile ("foo.txt");

  if (myfile.is_open()){

    while (!myfile.eof()){
      getline (myfile,line);
      cout << line << endl;
    }
    myfile.close();
  }
  return 0;
}
```
```
post your code and I can give you more specific help to your problem...