Results 1 to 3 of 3
Is there a way to restart dhcp through c? I want to do the equivalent of 'dhcpcd restart' through c. I figure there has to be a way, but I ...
- 10-04-2007 #1Just Joined!
- Join Date
- Aug 2007
- Posts
- 9
Restarting DHCP from C
Is there a way to restart dhcp through c? I want to do the equivalent of 'dhcpcd restart' through c. I figure there has to be a way, but I can't figure out how. Any help would be appreciated. Thanks.
- 10-04-2007 #2
You use the system() to do things like this.
So something like:
System returns the status of the process it forks. man 3 system is your friend. Note that restarts the dhcpd, the server. If you mean your dhcp client, it's probably dhcpcd.Code:statRet = system("/sbin/service dhcpd restart"); if (statRet != 0) fprintf(stderr, "Error restarting dhcpd\n");
- 10-04-2007 #3Just Joined!
- Join Date
- Aug 2007
- Posts
- 9
cool thank you.


Reply With Quote