Van N. Sy wrote:

> How do I tell C to run an executable file located in my hard 
> disk. I have a SUN SparcStation5 running under SunOS 4.1.4.

It depends upon what you mean by `run'. To change the executable which
is being run by the current process, you use the exec*() functions
(execl, execlp, execle, execv, execvp, execve).

To start another process running a different program (i.e. the current
process continues running the same program), you call fork() to create
a child process, and then the child process calls one of the exec*()
functions.

ANSI C provides a convenience function, system(), which runs another
program as a subprocess, and waits for it to terminate. The program is
run via /bin/sh, so you can use shell constructs in the command.

There is also the popen() function, which runs a command as a
subprocess, and returns a `FILE *' through which the parent process
can read either the standard input or output of the subprocess.

-- 
Glynn Clements <[EMAIL PROTECTED]>

Reply via email to