...

View Full Version : quick C question using execl()



Jimsta
01-24-2004, 10:43 AM
Hi everyone.
Im currently testing an example given to me that uses the C execl() function (the function looks up for a file composed of a command, eg win32 files, executes them and then terminates). Im getting no probs in terms of syntax structure, but the program does not appear to be terminating the command. The code is shown below

#include <stdio.h>
#include <process.h>
int main()
{
printf("testing connection:\n");
execl("c:\windows\system32\ping.dos","ping","localhost",0);
return 0;
}

Mhtml
01-24-2004, 10:56 AM
execl does not return to the calling process.

Jimsta
01-25-2004, 01:32 AM
Originally posted by Mhtml
execl does not return to the calling process.

Sorry, but what my actual concern is why isn't the command executing before it terminates ?

Mhtml
01-26-2004, 02:08 AM
Oh right I see, well check to see what it returns. If you get anything returned there is a problem with the command.

Oh, lol I see it ;) ... What is "ping.dos" ?? now call me silly but I thought that ping, along with most programs on windows used .exe ..

Jimsta
01-29-2004, 08:23 AM
Originally posted by Mhtml
Oh right I see, well check to see what it returns. If you get anything returned there is a problem with the command.

Oh, lol I see it ;) ... What is "ping.dos" ?? now call me silly but I thought that ping, along with most programs on windows used .exe ..

:) thanks for picking that up, but *if* i am right, u don't have to explicitly declare the file extension. I tried it without the :o any extension and still had no luck.

Also, another quick question, what should happen is that the msdos command is quickly executed and then it goes back to the source code screen?

Thanks for all your help so far though.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum