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?
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.
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.
can you email me your executable so I can see what you are talking about...
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....
No no, it's not a console program, it's pure windows. That's why a dos box flashes up every time.
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?
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.
To move files, look up the MoveFile() API function, to copy, look up CopyFile(). Look up CreateProcess() to run other programs.