Creating a text editor.
Thread 1 creates a file and listens for user input.
Thread 2 checks for spelling mistakes.

How do I show spelling mistakes on the console? Should I highlight the text that has the spelling mistake? I tried that but it just highlights the following text in the console.

My code:

void TeditCommand(){
    ofstream output(paths[1]);
    string temp;
    if(output.is_open()){
        cout << "\n\nText Editor\n";
        cout << paths[1] << endl;
        cin >> temp;
        output << temp;
        output.close();
    }
    else{
        cout << "Cannot open file" << endl;
    }

}

void TeditSpellCheck(){
    ifstream infile(paths[1]);
    string word;
    if(infile.is_open()){
        while(getline(infile,word)){
            if(word!=checker.correct(word))//if word not equal to a possible correct word
            {
                HANDLE hStdout = GetStdHandle(STD_OUTPUT_HANDLE); 
                if (hStdout == INVALID_HANDLE_VALUE) 
                {
                 cout << "Error while getting input handle" << endl;
                }

                SetConsoleTextAttribute(hStdout, FOREGROUND_BLUE| BACKGROUND_BLUE | FOREGROUND_INTENSITY);
            }
        }
    }
}

In the main():

                    thread first(TeditCommand);
                    thread second(TeditSpellCheck);
                    //TeditCommand();
                    //TeditSpellCheck();
                    first.join();
                    second.join();

Win32 Console Application

How do I show spelling mistakes on the console? Should I highlight the text that has the spelling mistake?

Up to you. If you want to manipulate the console in that way, you're going to have to read up on how your console works (which is heavily system dependent - C++ assumes very, very little about your console, as C++ needs to work for wristwatches and microwave ovens as well as a desktop PC).

What are the requirements?

This article has been dead for over six months. Start a new discussion instead.