473,666 Members | 2,048 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to start a program using another program?

11 New Member
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(Dire ctory,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
1 1797
horace1
1,510 Recognized Expert Top Contributor
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

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

Similar topics

0
2023
by: Bill Davy | last post by:
I am building a C++ program (main.exe) with VC6 which expects to call the Python DLL. When I start it (under the debugger), I get: "This application has failed to start because python24_d.dll was not found. Re-installing the application may fix this problem." I built Python24_d.dll using VS.NET 2003 (which I bought specifically for that purpose but cannot use for our project, boo hoo). I am building a debug version of main.exe which...
12
4094
by: GTi | last post by:
I have small program that always must be running when a user is logged on. Since users can close this program I must create a program that always check if this program is running. So I created a program in C# (my first!!) and it works with one major problem. This program detects when the desktop program is not running and starts it again. All works as expected BUT The desktop program is running as a SYSTEM user. That is not what I...
4
3568
by: Jesse Cates via DotNetMonster.com | last post by:
I am trying to launch a command-line program that came with a program called Live Stats. This command-line program is used to automate configuration of Live Stats. In order to test this, I am just calling the program with no arguments, which just returns some "how to use" text, and requires no user input. The problem is that once I do a .start on the process, the program just hangs indefinitely. I can see it running in the process list on...
5
13413
by: SiD` | last post by:
when starting a windows service writte in vb.net, a messagebox appears: cannot start service from the command line or a debugger. A windows service must first be installed using installutil.exe and then startede with the serverexpl, windows services or the NET START command. tryed also installing with installutil: it says there is no install packs. how can I make my service work in design mode and in normal runtime mode?
17
6430
by: UJ | last post by:
Is there any way for a windows service to start a windows program ? I have a service that will need to restart a windows app if it needs to. TIA - Jeff.
16
2524
by: pamelafluente | last post by:
I am still working with no success on that client/server problem. I need your help. I will submit simplified versions of my problem so we can see clearly what is going on. My model: A client uses IE to talk with a server. The user on the client (IE) sees an ASP net page containing a TextBox. He can write some text in this text box and push a submit button.
2
1758
by: holysmokes99 | last post by:
I am developing a component in .Net 1.1, and want to debug it using the "start external program" of the debugger in the IDE. The program I want to start references both 1.1 and 2.0 components. The problem is that when I launch this from VS2003, the external program starts only for a moment and then bails out of memory with no error, and the ide returns to a stopped state awaiting my input. If I remove the 2.0 framework, at least the...
10
1962
by: Doug Robertson | last post by:
First off, I'm a hardware/OS guy. I just write code on the side and I'm completely self taught - so bear in mind my total lack of expertise. I have a program originally written in VB2003 using the dotnet 1.1 framework. The program makes extensive use of Win32 API calls to help manage and track remote access sessions with out clients. I've left it running for days at a time on my system with no problems. It has always been stable. I...
4
21717
by: carson | last post by:
I have written two windows services: - service A does some crunching of local data files and uploads them to a central processing computer via http. - service B monitors a manifest file on a webserver to see if service A needs to be updated. What service B does if it sees their is an update for service A is to download a new copy of the service A executable, stop service A, replace the executable with the new copy, and start service B...
0
3277
by: =?Utf-8?B?am1hZ2FyYW0=?= | last post by:
My program needs to do X when someone 'starts using' their Windows user account, and it should do Y when they 'stop using' their Windows user account. By 'starts using' I mean they log on, unlock the desktop, resume from hibernate/sleep, or resume a session that was paused via Switch User. By 'stop using' I mean they lock the desktop, initiate a hibernate/sleep , or choose Switch User while logged on. For context, the program is a parental...
0
8445
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8781
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8551
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8640
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7386
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5664
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2771
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2011
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1776
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.