AllExperts > Experts 
Search      

C

Volunteer
Answers to thousands of questions
 Home · More Questions · Answer Library  · Encyclopedia ·
More C Answers
Question Library

Ask a question about C
Volunteer
Experts of the Month
Expert Login

Awards

About Us
Tell friends
Link to Us
Disclaimer

 
 
 
 
About Prince M. Premnath
Expertise

I'm sure that I can solve any doubts in Turbo C ,Graphics Programing ,Mouse, Hardware Programming ,File System ,Interrupts, BIOS handling , TSR Programming , General Concepts in C Language, handling inline Assembly statements

Experience
  • Experience in this area :
  • Research over 4+ years.
  • Education/Credentials :
  • Masters in Computer Applications
  • Organization belongs to :
  • ST Joseph College (SFS) Trichy

 
   

You are here:  Experts > Computing/Technology > C/C++ > C > Run an EXE file

Topic: C



Expert: Prince M. Premnath
Date: 2/26/2008
Subject: Run an EXE file

Question
Case:- Im my desktop, there is an ITQUE.EXE file.
Que:-  I want to make a program in C language to Run this ITQUE.EXE file. Plz give me the program.

Answer
Hi Dear ashok !

A group of built- in functions are available to perform this task suppose you are working in c:\tc directory  , and you wish to execute a EXE file named "sample.exe"
just use the "spawnl()" function available in process.h header  file

FILE : sample.c
void main()
{
 printf("Sample .c Program\n");
}
/* save and compile the file */


FILE: EG.C
void main()
{
 spawnl(P_WAIT  , "sample.exe" , NULL);
 printf("This is from eg");
}

The output of eg.c will be:
sample.c Program
This is from eg

this simple C program will execute your sample.exe program and return control to the main program .


Here what you supposed to do is to specify the correct path name (  where your .EXE file located in your system . ) as a second argument to the spawnl() function .

Please revert me in case of issues !

With Thanks and Regards !
Prince M. Premnath

Add to this Answer    Ask a Question



  Rate this Answer
   Was this answer helpful?
Not at allDefinitely              
   12345  

     
About Us | Advertise on This Site | User Agreement | Privacy Policy | Help
Copyright  © 2008 About, Inc. About and About.com are registered trademarks of About, Inc. The About logo is a trademark of About, Inc. All rights reserved.