0

I have done programs that print themselves on execution,but is it possible for a c program to execute itself or another c program whose path is specified??

3
Contributors
3
Replies
4
Views
11 Years
Discussion Span
Last Post by kris.c
0

I have done programs that print themselves on execution,but is it possible for a c program to execute itself or another c program whose path is specified??

You mean executing another program from within a program?

0

Yes. Want to know how?

It's operating system specific, but one general option is to use the 'system' procedure. Or, if you're using a Unixy operating system and want more control over how things are done, look at execve and its friends ('fork' followed by 'execv' will start a new process. You'd have to understand how these work, which you can do by, um, reading documentation). (If you're looking at a Windows operating system, you can find documentation on its API online somewhere too.)

0

thanks.. the system fuction sugeested does the job I needed

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.