1

I am working on a windows sever program using c++, when the program started it stays for several days and output important logs to the default windows console. now I want to add some control function to the console, like I cound enter something like query or stop, and the program ouput the variable number or stop accept requests. So there is the problem, I got two output stream(log and query response) and one input stream both mixed in one single console. How do I seperate the three different stream in one single console? Maybe I cound write my own console to replace the default windows console?

I believe this is a very normal need and a lot of server application has implemented this but I could not find any source code...

I know I could use ncurses, but I think ncurses seems too low level for this. Any suggestion will be apprecitated.

Jason
  • 259
  • 1
  • 3
  • 12
  • The one solution (maybe not the best) is to paint each *stream* in different colors. I have a set of functions to colorize console output both at Windows and at Linux. I can give you them, if you want – borisbn Jan 18 '13 at 05:47
  • won't that be even hard to read if different color text mixed together? I think to seperate them in different regions might be the right direction. thanks – Jason Jan 18 '13 at 06:18
  • 1
    If I were in you shoes, I'd implement additional commands in another program then run it as a child process which has its own console. – 9dan Jan 18 '13 at 07:29
  • Does it have to be a classic console? If not, try a GUI library of your liking, providing separated input and output text areas in one window. In pure C++ this will not be possible. I think ncurses is the most popular choice for twiddling with the console, and it does not seem too hard to write a thin C++ layer for your needs. – Arne Mertz Jan 18 '13 at 09:03
  • @9dan: additional process is a good idea, although it might result in too many console windows if you open several server instance. still good idea, thank you – Jason Jan 18 '13 at 09:30
  • @Arne Mertz: I always program server application so I am really not familiar with any gui lib. I don't know whether ncurses is as powerful as it under linux. I will give it a try. thank you! – Jason Jan 18 '13 at 09:40
  • @Jason same here. Never used GUI libs myself actively, bu i've seen "one window, few controls" GUIs that were implemented in just a few lines. Many GUI libs have basic tutorials that cover all the things necessary for your needs. After all, you are not looking for complicated dialog sequences ;) – Arne Mertz Jan 18 '13 at 10:30

0 Answers0