Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   C (http://www.programmingforums.org/forum60.html)
-   -   How can "A" run a "B" program? (http://www.programmingforums.org/showthread.php?t=10748)

hipolito Jul 17th, 2006 10:21 AM

How can "A" run a "B" program?
 
I have an "A" program and I want this one to run a "B", "C" and "D" program.

How?

thx.

Infinite Recursion Jul 17th, 2006 10:28 AM

use the system() function.

EDIT: vOid provides better detail, a minute difference in posts... has to be a record.

v0id Jul 17th, 2006 10:29 AM

If you're using Windows you can use normal command line commands
:

  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5.   system("C:\\path\\path\\myProgram");
  6.  
  7.   return 0;
  8. }


Edit: I was too late to post, Infinite Recursion came first :)

DaWei Jul 17th, 2006 10:40 AM

Latest of many.
Quote:

Originally Posted by FAQ/Rules
Posting Rules:

1. Always search before you post - Chances are, if you have a question, someone else has the same question. More importantly, the answer is probably somewhere out there already if you just take a minute to look. Before posting a new question, always do a search first. Your question might have already been posted and answered on this site. Second, do a Google search. A simple google search is usually all you need to find the answer to just about anything. All of the guys and gals helping out and answering questions around here are volunteers. By trying out these two methods before asking a question, you'll save hours of time that could have been wasted constantly answering the same questions multiple times.

http://www.daweidesigns.com/images/search.jpg

Sane Jul 17th, 2006 12:14 PM

Dawei, do you mind if I hotlink that image, or should I upload my own copy for when the time comes? ;)

*bookmarked*

DaWei Jul 17th, 2006 1:12 PM

LOL, Sane, whatever you like. I stole if from the forum and performed a superb technical feat called a "crop".

hipolito Jul 17th, 2006 1:13 PM

great help guys, thx

hipolito Jul 17th, 2006 4:39 PM

Well one more issue, I want to run "B", "C", and "D" at the same time, and what system does is run "B" and then after it is done it goes and run "C".

Is there a way so I can run all three at the same time?

thx

DaWei Jul 17th, 2006 4:45 PM

You need to get into the issues of multiple processes. This will hinge upon your system. You will have to study some, ask your mama, or come back here with some additional information. A "How to ask questions the smart way" might short circuit your next exercise. One link can be found in the forum's FAQ/rules thread.

The Dark Jul 17th, 2006 8:51 PM

Have a look at the spawn (spawnl, spawnlp, etc) group of functions, they should do what you want.


All times are GMT -5. The time now is 12:20 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC