467,915 Members | 1,599 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,915 developers. It's quick & easy.

How to start a program using another program?

Well...
So, i have a program. A normal program, which does something, and so..
and i have another program, which wants to run the first program....
So, there are 2 questions about that problem ->
1) How can i run the program using another program? Is there anything like runProgram(Directory,Name.exe)?
2) Programs usually returns the 0 value when they end. So, can i, for example, put something like
Expand|Select|Wrap|Line Numbers
  1. int main(){
  2. int something;
  3. //do something to the variable something
  4. return something;
and get the value using another program?
Jan 25 '07 #1
  • viewed: 1438
Share:
1 Reply
Expert 1GB
you can use the system() function in C and C++, e.g.
Expand|Select|Wrap|Line Numbers
  1. #include <stdio.h>
  2. #include <process.h>
  3.  
  4. int main(void)
  5. {
  6.     system("dir *.c");                                         /* call system */
  7.     printf("parent program resumed");
  8.     return 0;
  9. }
  10.  
the parent process is suspended, the child process runs, when child stops parent resumes

If you want to run concurently use spawnl()
Jan 25 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

12 posts views Thread by GTi | last post: by
4 posts views Thread by Jesse Cates via DotNetMonster.com | last post: by
5 posts views Thread by SiD` | last post: by
10 posts views Thread by Doug Robertson | last post: by
reply views Thread by =?Utf-8?B?am1hZ2FyYW0=?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.