hi,
Following code is not working.Help me
#include<stdio.h>
#include<dir.h>
void main()
{
system("myprogram.exe");
}
Please tell me that how system command command work.
Donot use link to tutorial of this site.It is not working.
thanks
hi,
Following code is not working.Help me
#include<stdio.h>
#include<dir.h>
void main()
{
system("myprogram.exe");
}
Please tell me that how system command command work.
Donot use link to tutorial of this site.It is not working.
thanks
If ur OS is Windows then forget abt it. It never worked for me either.
I'm not sure if you are getting a compile time or runtime error, but I believe system() is part of stdlib.h. Try including that.
If that does not solve your problem, please give a description of the error you are receiving.
Jason Deckard
Also, your current working directory might not be what you think it is. Consider using the full path to 'myprogram.exe', instead of assuming it will be found.Originally posted by vk
system("myprogram.exe");
Jason Deckard
Or have the executable file in the directory of the other program.
Try omitting the .exe off of the end.
Quzah.
Hope is the first step on the road to disappointment.
>>Try omitting the .exe off of the end.
That wont do it. How about Try; "Giving some useful information such as what isnt working... Some errors maybe? Some symptoms? Throw us a bone!"
"There's always another way"
-lightatdawn (lightatdawn.cprogramming.com)
The problem is that you are just saying run this program when the current working directory is somewhere else.
Do this:
That should workCode:#include <stdio.h> #include <stdlib.h> int main() { system("c:\\system\\program.exe"); return0; }
And don't put in stdio.h because you do not need it...
!!!!!ANSI!!!!!!
Code:#include <stdlib> using namespace std; // or using std::system int main() { system ("cls"); system ("pause"); system ("ping http://www.yahoo.com"); system ("yourfile.exe"); system ("pause"); system ("cls"); return 0; }
Blue
Go back to the C++ board. We don't use name spaces or "<stdlib>" here.Originally posted by Betazep
And don't put in stdio.h because you do not need it...
!!!!!ANSI!!!!!!
Code:#include <stdlib> using namespace std; // or using std::system int main() { system ("cls"); system ("pause"); system ("ping http://www.yahoo.com"); system ("yourfile.exe"); system ("pause"); system ("cls"); return 0; }
Quzah.
Hope is the first step on the road to disappointment.
LOL...
Sorry about that... followed it in from a link.
Do you use system? I thought that was a C++ standard function?????
Blue
http://www.dinkumware.com/htm_cpl/stdlib.html
Guess it is... so woops!!!
Blue
Many functions that are standard to C are also in C++. Just like the syntax is the same. Basicly C++ is an extension of C, and as such, it has many similar functions and behaviour.
Quzah.
Hope is the first step on the road to disappointment.