Suppressing console window when calling system()

Discussion in 'C++' started by stevie.greenslade@gmail.com, Sep 13, 2006.

  1. Guest

    '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, 2006
    #1
    1. Advertising

  2. Pavel Guest

    ....
    > 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
    Pavel, Sep 13, 2006
    #2
    1. Advertising

  3. Guest

    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, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John Salerno

    suppressing the console in a GUI program

    John Salerno, Aug 1, 2006, in forum: Python
    Replies:
    2
    Views:
    302
    placid
    Aug 1, 2006
  2. suppressing the console window

    , Jun 22, 2006, in forum: C Programming
    Replies:
    4
    Views:
    405
    jacob navia
    Jun 22, 2006
  3. Miktor
    Replies:
    7
    Views:
    12,030
    Joe Bacigalupa
    Aug 9, 2005
  4. 1SALz

    Suppressing logon window

    1SALz, Oct 28, 2003, in forum: ASP .Net Security
    Replies:
    4
    Views:
    106
  5. jackster the jackle

    system ( ) call but suppressing =>true

    jackster the jackle, Dec 19, 2007, in forum: Ruby
    Replies:
    5
    Views:
    110
Loading...

Share This Page