473,320 Members | 1,936 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Suppressing console window when calling system()

'Lo all.

I have a simple question I'd like help on. :]

How, if at all, would one go about suppressing the console window that
flashes up when you make at system() call in your C++ program? I'm
using Dev-C++ with GTK-- with all the 'GUI' options ticked. There is
nothing functionally wrong with the program save this flashing console
window.

The calls in question are to console apps that reside on the target OS,
the best example I could think of would be passing some info through
grep. (Why re-invent the wheel eh?)

I'd like to keep the solution as lightweight as possible, as I do plan
to make the program support both Linux and Windows, and it must be
compatible with Windows 2K. Although I am currently only compiling
under Windows, so I'll leave the Linux questions for later. :]
(So sadly http://msdn.microsoft.com/msdnmag/issues/04/02/CQA/ wouldn't
work it seems.)

Cheers in advance,

~ Steven

Sep 13 '06 #1
2 2362
....
How, if at all, would one go about suppressing the console window that
flashes up when you make at system() call in your C++ program? I'm
using Dev-C++ with GTK-- with all the 'GUI' options ticked. There is
nothing functionally wrong with the program save this flashing console
window.
....
I'd like to keep the solution as lightweight as possible, as I do plan
to make the program support both Linux and Windows, and it must be
compatible with Windows 2K. Although I am currently only compiling
...
CreateProcess(..) on Windows, fork() followed by exec() and some of the
wait()s on UNIX[es]. Unfortunately, the process spawning design is
different on these OSes; hence will most probably have to #ifdef some
parts of your implementation. It is worth to check first how Cygwin
handles the issue but I doubt it has a full-fledged fork()..

Hope this helps

-Pavel
Sep 13 '06 #2

Pavel wrote:
...
How, if at all, would one go about suppressing the console window that
flashes up when you make at system() call in your C++ program? I'm
using Dev-C++ with GTK-- with all the 'GUI' options ticked. There is
nothing functionally wrong with the program save this flashing console
window.
...
I'd like to keep the solution as lightweight as possible, as I do plan
to make the program support both Linux and Windows, and it must be
compatible with Windows 2K. Although I am currently only compiling
..
CreateProcess(..) on Windows, fork() followed by exec() and some of the
wait()s on UNIX[es]. Unfortunately, the process spawning design is
different on these OSes; hence will most probably have to #ifdef some
parts of your implementation. It is worth to check first how Cygwin
handles the issue but I doubt it has a full-fledged fork()..

Hope this helps

-Pavel
Thanks for your reply. =]

It's taken some fiddling, but it's working (almost) perfect. A bit more
playing around and it should be done.

Cheers for sending me down the right Google path!

~ Steven

Sep 13 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Oz | last post by:
This is long. Bear with me, as I will really go through all the convoluted stuff that shows there is a problem with streams (at least when used to redirect stdout). The basic idea is that my...
1
by: Bill Woodruff | last post by:
I know, it's a weird question, but I am experimenting with a multi-form app where I need to override Dispose calls and want to start the app this way. thanks, Bill Woodruff dotScience Chiang...
17
by: MumboJumbo | last post by:
Hi I have a really basic question hopefully some can help me with: Can you write a (i.e. one) C# project that works from the cmd line and gui? I seems if i write a GUI app it can't write to...
11
by: Chris | last post by:
Hi, For info I am using VS 2005 beta 2 I have a Console App and I want it to do the equivalent of a Change Directory (CD) command that you would do in normal command line mode as follows: ...
3
by: Dean Slindee | last post by:
I have a exception handling class that could be called from either a windows project app or a console project app. Is there any way for this class to determine which type of app called it without...
8
by: nadeem_far | last post by:
Hello All, These days I am working on a console application that will register for certain events and do some processing based on the event notification. Now, all the objects are being created...
0
by: Mythran | last post by:
I can draw onto the console window where I want using a mixture of API calls and the System.Drawing namespace (.Net 1.1). I am trying to install hooks for the window to catch a resize or another...
4
by: pdmountaineer | last post by:
hi, with the well-known C command "system", DOS commands can be executed from a simple C-program. Is there a possibility to suppress the console window to pop up when executing a DOS command...
10
by: Stephany Young | last post by:
When one uses the System.Diagnostics.Process.Start method to launch a common or garden Console application, one can set the WindowStyle property of the StartInfo object to ProcessWindowStyle.Hidden...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.