system() hidden

This is a discussion on system() hidden within the C++ Programming forums, part of the General Programming Boards category; When I use the system() command a dos prompt pops up. How can I supress this dos window?...

  1. #1
    Registered User
    Join Date
    Feb 2006
    Posts
    71

    system() hidden

    When I use the system() command a dos prompt pops up. How can I supress this dos window?

  2. #2
    Registered User
    Join Date
    Aug 2003
    Posts
    1,199
    Why use system to do stuff when you can use better functions, like those mentioned in
    http://faq.cprogramming.com/cgi-bin/...&id=1043284392
    STL Util a small headers-only library with various utility functions. Mainly for fun but feedback is welcome.

  3. #3
    Registered User
    Join Date
    Feb 2006
    Posts
    71
    Quote Originally Posted by Shakti
    Why use system to do stuff when you can use better functions, like those mentioned in
    http://faq.cprogramming.com/cgi-bin/...&id=1043284392
    Ok I want to send a command to the cmd.exe and get the output back. What function would you use to do this?

  4. #4
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,484
    Try _popen() - it works much like fopen()

    Also, which command are you trying to read the output of?
    If it's something like "dir", then there are better alternatives.

  5. #5
    Registered User
    Join Date
    Feb 2006
    Posts
    71
    Quote Originally Posted by Salem
    Try _popen() - it works much like fopen()

    Also, which command are you trying to read the output of?
    If it's something like "dir", then there are better alternatives.
    Any That what the user inputs in my programm should go to the cmd.exe the output back to my programm.

  6. #6
    Registered User
    Join Date
    Feb 2006
    Posts
    71
    OK works fine, but the dos box still pops up
    Last edited by keeper; 03-12-2006 at 06:59 AM.

  7. #7
    Registered User
    Join Date
    Aug 2005
    Posts
    1,267
    You can use win32 api function CreateProcess() which has an option disable the command window, but it works more like system() than _open().

Popular pages Recent additions subscribe to a feed

Similar Threads

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

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