PDA

View Full Version : Console application questions



Morea
20th November 2008, 19:44
Hi.
I'm trying to create a small console application that should be a tcpserver. I'm a little interested in how a minimal main.cpp file should look.
Any small short informative example would be nice

I'm thinking of creating a class "main", and then create an object that is the actuall "program". Is this alright?
The "main" class should be a tcpserver, so I guess I should subclass from the QTcpServer?

A question: how do I quit from my program?
Let's say it calls one of it's own methods "giveUp()" that disconnects all connections and then quits, how should I quit?

fnmblot
20th November 2008, 20:37
http://doc.trolltech.com/4.4/index.html is the best place to start

Morea
21st November 2008, 18:34
Hmm, the docs are a little sparse sometimes when it comes to how to structure your programs.

jacek
21st November 2008, 19:32
Let's say it calls one of it's own methods "giveUp()" that disconnects all connections and then quits, how should I quit?
The same way as in GUI application. Make QCoreApplication::exec() return by calling quit().