views:

192

answers:

2

I'm developping a very simple app on my Ubuntu using QtCreator.

It's a console application and I want the user to enter its name, and then I display his name. Here is the code :

#include <iostream>

int main(int ArgC, char* ArgV[])
{
    char Name[1000];

    std::cout << "Type your name : ";
    std::cin >> Name;

    std::cout << "Hello " << Name << "\n";
    return 0;
}

When running this app with QtCreator, the string "Type your name :" is displayed in the 'Application Output' tab. But if I type some text and press the enter key, nothing is happening.

What's wrong ?

+4  A: 

Looks like "Application Output" tab doesn't support Input. Try to start your application in standalone console.

Kirill V. Lyadvinsky
A: 

You should not use std::cout & library when you code in Qt

zobi8225