Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //main.cpp
- #include <QCoreApplication>
- #include <QSocketNotifier>
- #include <stdio.h>
- #include "obj.h"
- #include <iostream>
- int main( int argc, char *argv[] )
- {
- QCoreApplication a( argc, argv );
- QSocketNotifier notifier( STDIN_FILENO, QSocketNotifier::Read );
- Obj o;
- QObject::connect( ¬ifier, SIGNAL( activated(int) ), &o, SLOT( onReadyRead(int) ) );
- std::cout << ">>";
- return a.exec();
- }
- // obj.cpp
- void Obj::onReadyRead(int)
- {
- std::string command;
- std::cin >> command;
- std::cout << std::endl << "command is: " << command << std::endl << ">>";
- }
Advertisement
Add Comment
Please, Sign In to add comment