I think that omitting the "std" namespace qualifier or "using" directive would have resulted to compiler errors.
You forgot to mention what would be the purpose of this example project. I ask it because it may produce exactly the same error symptoms as Marius Cirsta's: if he tries it, it is likely that he won't see the last line of the output, because cout does buffered IO, and it does not have a chance to do its delayed output: in the next line you call a.exec(), which enters the application's message loop and there your program reaches an endless loop. You can try to flush your output to push the buffered data out: cout << "You hitted: " << chr << flush; Unfortunately this only guarantees that the program passes the data to the OS. The underlying OS services are also allowed to do internal buffering, so the string may or may not appear on the screen. Again, the real problem is the a.exec() function call: you should send some quitting message to it otherwise the program will hang. I found an example here: http://qtnode.net/wiki/Hello_World_(Console) -- Tamás 2010/3/28 M. Bashir Al-Noimi <[email protected]>: > Try the attached project. > > On 28/03/2010 01:14 م, Marius Cirsta wrote: > > I just wrote a simple program to use std::cin under Linux and I can't get > it to work with Qt Creator 1.3.1. I get the application output but it > doesn't recognize the ENTER key and so doesn't accept the input value that I > type. My terminal is set the xterm -e unde Environment, General. > > Any solutions to this ? > > _______________________________________________ > Qt-creator mailing list > [email protected] > http://lists.trolltech.com/mailman/listinfo/qt-creator > > > -- > Best Regards > Muhammad Bashir Al-Noimi > My Blog: http://mbnoimi.net > > _______________________________________________ > Qt-creator mailing list > [email protected] > http://lists.trolltech.com/mailman/listinfo/qt-creator > > _______________________________________________ Qt-creator mailing list [email protected] http://lists.trolltech.com/mailman/listinfo/qt-creator
