Click here to Skip to main content
15,891,033 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello everyone.

How I can add a static IP route with C/C++/VC6.0? For example, my IP is 192.168.12.1 and I want to set it to be the default gateway. Just input "route -p add 0.0.0.0 mask 0.0.0.0 192.168.12.1" in CMD.EXE. But I want a program to do this, how can I make it? Please show me your code.

I would appreciate it if you help me. Many thanks!
Posted
Updated 5-Jun-10 3:45am
v4
Comments
#realJSOP 5-Jun-10 8:08am    
Don't put your email address in your messages.

Unless you're writing a system management configuration utility, don't do that.
Your program -in general- is not the "owner" of the computer it runs on, that is not -in turn- the owner of the network it belongs.
 
Share this answer
 
You can use system("route -p add 0.0.0.0 mask 0.0.0.0 192.168.12.1"), but it's probably not a very good idea. I don't even think I came up with it if someone asks. This post was never submitted.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900