I need to execute some dos commands like executables(.exe)
PLEASE HELP ME OUT OF THIS

I need to execute some dos commands like executables(.exe)
PLEASE HELP ME OUT OF THIS

Read more about the "system" command in C language.Your every requisite would get fulfilled.
Through system command you can call all commands you can call in a command prompt mode and also execute certain kinds of files too.

Please, never use "system" command in C term in this context. No "commands" in C. The system is a library function in C...

Take a look at ShellExecute

Edit: I misunderstood ArkM's post, I thought it was advising against the use of system() (as is usually the case). I suppose in this case, it would be okay?

I have never came out against this part of the C language Standard ;)
It's exactly the program case for the system standard library function (not command)...

Ah, I wasn't saying you always bash the system function, but whenever it appears in code just about everyone else goes crazy.

>Arkm
>death_oclock
Well I couldn't really make out if you people were against usage of system library function here in this context.If yes could you state the reason...?

>Well I couldn't really make out if you people were against
>usage of system library function here in this context.
By my reading, death_oclock isn't sure, and ArkM hasn't stated a preference.

>If yes could you state the reason...?
In this case, system is still risky, but no more risky than ShellExecute as they both have the same vulnerability: unless you're careful about the path you pass, a malicious program can be run in place of the one you expected.

>Well I couldn't really make out if you people were against
>usage of system library function here in this context.
By my reading, death_oclock isn't sure, and ArkM hasn't stated a preference.

>If yes could you state the reason...?
In this case, system is still risky, but no more risky than ShellExecute as they both have the same vulnerability: unless you're careful about the path you pass, a malicious program can be run in place of the one you expected.

Path is still a user input right ? As both system and ShellExecute have same problems on the system side execution,its just the path which determines whether it would suit this application or not.
So once we are sure that the path given by user is right the system(<path>) should not create any problem.Isn't it Naure?

>Path is still a user input right ?
I don't know, the OP changed his post so that it no longer specifies.

>So once we are sure that the path given by user is right
>the system(<path>) should not create any problem.
It can still create problems, but those problems aren't something you can easily control with code.

This article has been dead for over six months. Start a new discussion instead.