473,388 Members | 1,064 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,388 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 2364
....
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
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.