exicut_file_in_c

S

skyspy

hi friends,
Can any one tell me how to execute an executable file
like test.exe by c programme.


-aakash
 
R

Richard Heathfield

skyspy said:
hi friends,
Can any one tell me how to execute an executable file
like test.exe by c programme.

See "The C Programming Language", 2nd edition, by Kernighan and Ritchie,
page 167, or "C - A Reference Manual", 4th edition, by Harbison and Steele,
page 407.
 
A

August Karlstrom

skyspy said:
Can any one tell me how to execute an executable file
like test.exe by c programme.

#include <stdlib.h>

int main(void)
{
system("test");
return 0;
}


August
 
R

Richard Heathfield

August Karlstrom said:
#include <stdlib.h>

int main(void)
{
system("test");

On some systems, that will fail, even if test.exe is available for such use,
because "test" is not necessarily a synonym for "test.exe".
 
K

Kenny McCormack

August Karlstrom said:


On some systems, that will fail, even if test.exe is available for such use,
because "test" is not necessarily a synonym for "test.exe".

Yes, and on some systems, it will fail because you run out of disk space
while trying to compile it.

Thus showing the idiocy of this "It must be guaranteed to run
everywhere, everytime, or else it is crap" mentality.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top