cin is not blocking (C++)

Hi


I'm trying to write a little text based application and this is my code:


   void loop()
    {
        std::string selection;
        
        cout << "Initializing Manual Sampler Thread" << endl;
        while(true)
        {
            cout << "Command:" << endl;
            cin.clear();
            cin >> selection;
            
            cout << "<<selection" << selection << endl;
        }



But it comes out as:




Shadow Engine (RavenTek) Version 1.0 Build 1.0

Developed by Twilight Raven Games

-------------------------------------

Starting CORE

Performing initialization of threads

Host a game? (Y/N)

y

Host game?

Core intializing

Initializing CORE 1.0

Initializing Clock thread

Initializing Task Manager Thread

Initializing Event Manager Thread

Intializing Scheduler Thread

Initializing MessageManager thread

Initializing Manual Sampler Thread

Command:

<<selectiony

Command:

Program ended with exit code: 0



It is supposed to block on cin where it says the command prompt but instead it just

steamrolls right through it.

In what type of environment are you running this ?

cin is not blocking (C++)
 
 
Q