Thread: about system()

  1. #1
    Registered User
    Join Date
    Aug 2001
    Posts
    79

    about system()

    I'm working on a program that act as a substitute for dos prompt (mostly for fun, it's not that useful), and a lot of the time I have to use system() to sort of leech on dos where I couldn't do something myself. However, this produces a really annoying dos box that flashes up every time I use one of those commands, so I was just wondering: is there any way to call the system() function and hide the dos box?

  2. #2
    _B-L-U-E_ Betazep's Avatar
    Join Date
    Aug 2001
    Posts
    1,412
    Are you programming a 16bit prog or a 32bit console prog?

    You say DOS.... by I think you are talking about an emulation of DOS.

    I have never heard of an error message when using a system call. I do it all the time with Console appz.

    Please explain a little more, and I will try to help you.
    Blue

  3. #3
    Registered User
    Join Date
    Aug 2001
    Posts
    79
    Ok, sorry for not being specific. It's a windows application (32bit) made with Borland C++ builder 5, but it still uses a few dos functions (as well as some borland-specific).
    It's not an error message I get, I simply want to get rid of the dos box because it's annoying.

  4. #4
    _B-L-U-E_ Betazep's Avatar
    Join Date
    Aug 2001
    Posts
    1,412
    can you email me your executable so I can see what you are talking about...

    [email protected]

    Your program is initially running in the console window isn't it?

    Are you saying that another console window opens up when you run your program?

    Or are you double clicking on the icon of the console application, and you want the console itself to not come up?

    This is interesting....
    Blue

  5. #5
    Registered User
    Join Date
    Aug 2001
    Posts
    79
    No no, it's not a console program, it's pure windows. That's why a dos box flashes up every time.

  6. #6
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    well how about you tell us why you are using system() when almost certainly there will be something in the win32 api to accomplish what you are doing.What exactly r u doing in the system calls?
    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

  7. #7
    Registered User
    Join Date
    Aug 2001
    Posts
    79
    I use system() to move and copy files (yes I know it can be done by reading from one file and writing to the other, but I'm lazy) and running programs and opening files.
    Running programs could be done using spawn(), but I couldn't get it to work properly. Opening files (i e the same as doubleclicking in windows) is probably harder.

  8. #8
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,829
    To move files, look up the MoveFile() API function, to copy, look up CopyFile(). Look up CreateProcess() to run other programs.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

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, 03:56 PM
  4. BIOS system and memory allocation problem
    By beely in forum Tech Board
    Replies: 9
    Last Post: 11-25-2003, 07:12 AM
  5. Number system base M, print numbers N digits wide...
    By biterman in forum C Programming
    Replies: 12
    Last Post: 11-19-2001, 04:31 AM