Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

An equivalent API _execlp but not terminating the caller process

Status
Not open for further replies.

dmxd99

Programmer
Jul 19, 2005
20
US
Anyone knows an ANSI way to call another Java program within C codes without replacing the caller process. _execlp is an API that is used to execute another program but it "terminates" the caller process and I don't want that.
 
There is no fork() in ANSI... and I can't use CreateProcess either. Any other suggestions? Thanks.
 
There's no _execlp in ANSI, either...


The only purely ANSI way to start a new is using [tt]system[/tt]. If that's not acceptable, you'll have to specify what environment you're using.
 
No any ANSI ways in obvious non-ANSI C-Java contact.
TryJava Native Interface (JNI), see Java manuals for your platform.
It's so intricate and ill-documented issue. But it works (some years ago, on Windows NT and Solaris;)...
 
I used _spawnlp and it worked to bring up nodepad, windows explorer but failed to bring up power point and the Java plotting package. Any ideas on why it worked on certain executable files and not others? I am using windows XP and visual studio 6.0 to compile source codes. Thanks.

_spawnlp(_P_WAIT, "explorer", "C:\\C\\explorer.exe", NULL);
The above worked fine
but
_spawnlp (_P_WAIT, "Jplot", "C:\\C\\Jplot.exe", NULL); has error. It returns nonzero.
 
Are you catching the return value, this might help in determining the problem. Other than that it could be that these programs require parameters to be passed to them.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top