Using System(), but invisible?

This is a discussion on Using System(), but invisible? within the C++ Programming forums, part of the General Programming Boards category; What I made can be called a "text interface" to a program that is ran by flags ([program name] -d ...

  1. #1
    Registered User
    Join Date
    Aug 2003
    Posts
    11

    Using System(), but invisible?

    What I made can be called a "text interface" to a program that is ran by flags ([program name] -d -f -l and etc), to make it easier for beginners to use it. However, once the program runs, it displays text, which appears on my program.

    Is there a way for me to make this child program "invisible", so my program does not display the text? I've seen this done before (on the same program ) in Visual Basic.

  2. #2
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    Not sure, but try looking up popen( ).
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

  3. #3
    ¡Amo fútbol!
    Join Date
    Dec 2001
    Posts
    2,136
    FAQ

  4. #4
    Registered User
    Join Date
    Aug 2003
    Posts
    11
    Im guessing it's using the Spawn option. With P_WAIT?
    Nothing talks about whether the text is visible or not...

  5. #5
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    You cannot use system and hide the console box. You would be better off using the winapi to do it.Look up OpenProcess or ShellExecute or similar family of functions in your helpfiles.
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  6. #6
    Me -=SoKrA=-'s Avatar
    Join Date
    Oct 2002
    Location
    Europe
    Posts
    448
    I think there's another way to what you wont to achieve. This should make the console not display any text and a window not to pop up (i think).
    Code:
    //...
    system("@ECHO OFF");
    system("program_name -options");
    or you could make another program that doesn't display any text at all. But I guess that's too much hassle.
    SoKrA-BTS "Judge not the program I made, but the one I've yet to code"
    I say what I say, I mean what I mean.
    IDE: emacs + make + gcc and proud of it.

  7. #7
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    Code:
    system("@ECHO OFF");
    system("program_name -options")
    That won't work, each call to system() gets you a new shell, and hence new environment.

    If you're doing this in a Windows console, a quick hack would be something like
    >>system("myprog >nul");

    You can see this in action by going to a command prompt and typing:
    dir >nul

    On *nix, you can redirect the output to /dev/null for the same affect.

    popen() is a good solution if you want to trap the output and read it into your program.
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  8. #8
    Registered User
    Join Date
    Aug 2003
    Posts
    11
    Thanks! That works fine!
    All about the quick hacks .

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. File System Implementation
    By dodgeviper in forum C Programming
    Replies: 9
    Last Post: 11-16-2007, 01:04 PM
  2. Using system icons
    By @nthony in forum Windows Programming
    Replies: 1
    Last Post: 01-13-2007, 07:56 PM
  3. Linux database system needed
    By BobS0327 in forum Tech Board
    Replies: 7
    Last Post: 06-11-2006, 04:56 PM
  4. measuring system resources used by a function
    By Aran in forum C Programming
    Replies: 1
    Last Post: 03-13-2006, 05:35 PM
  5. BIOS system and memory allocation problem
    By beely in forum Tech Board
    Replies: 9
    Last Post: 11-25-2003, 07:12 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21