#include <iostream>
#include <string>
#include <fstream>
using namespace std;
int main()
{
    fstream infile;
    infile.open("letter.txt");
    string s;
    char charArray[11];
    char x;
    while (!infile.eof())
    {
        infile.get(x);
        x = tolower(x);
        for (int i = 0; x != ' '; i++)
        {
            charArray[i] = x;
        }
        string mystring(charArray);
        cout << mystring;
    }
    system("pause");
}
In my C++ program I am to read from a file one character at a time and stop when the loop reaches a space (this would indicate the end of a single word). Then, I want to assign the contents of the char array to a string variable.
I know I can read one word at a time from the file, however for my assignment this is not a suitable solution.
My difficulty is converting from char array to a string variable .
 
    