Hey guys, I'm just starting to get back into C++ Programming, and forget how to call a System Command and input variable values into the command. Currently I am creating a little Internet Utility program, one of the options of the program is to allow the user to delete his/her current gateway route, and add a new one. How ever when creating a new one, you must enter the IP Address you would like to use as well as the network mask and gateway. Here is what I have already, but i know for a fact that it doesn't work.
Code:
/*Variables*/
char IP, mask, gateway; //user input information
system("cls"); //clear screen
SetConsoleTitle("Add Gateway route"); //reset Console title
cout<<"Please enter IP Address:\n"<<flush; //promted to enter ip address
cin>>IP; //enter IP Address
cout<<"Please enter network mask:\n"<<flush //prompted to enter network mask
cin>>mask; //enter network mask
cout<<"Please enter network gateway:\n"<<flush //promted to enter network gateway
cin>>gateway; //enter network gateway
/*Add gateway route*/
system("route add", IP, mask, gateway);
cout<<"\n\nPress <ENTER> to continue..."<<flush; //promted to continue
cin.get(); //hold screen
Thanks in advance
S0n1C!