E
enjoywithneha
Can anyone here please tell me how the system function is used to
execute DOS commands?
execute DOS commands?
Can anyone here please tell me how the system function is used to
execute DOS commands?
Can anyone here please tell me how the system function is used to
execute DOS commands?
[...]Richard Heathfield said:(e-mail address removed) said:
Can anyone here please tell me how the system function is used to
execute DOS commands?
See comp.os.msdos.programmer for DOS-specific information, but the system()
part of your question is topical here.
Let us assume you have some system-specific command, FOO, which you wish to
execute with arguments bar and baz. Here is one simple way to do it:
[...]
char command[128] = "FOO "; [...]
strcat(command, argument);
strcat(command, " "); [...]
strcat(command, argument);
system(command);
Strictly speaking, there's no guarantee that
system("FOO arg1 arg2");
will execute the command "FOO" with arguments "arg1" and "arg2". The
interpretation of the string passed to system() is entirely
implementation-defined. (It happens to work that way on every system
I'm familiar with, though.)
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.