Copyright © Programs ++
Design by Dzignine
Tuesday 24 January 2012

Get IP address your own computer

The IP (internet protocol) address is a command that displays the ip address of the host computer. The code given below displays the ipv4 adress,ipv6(if available), subnet mask and default gateway along with some additional information. The same can also be achieved by using the command prompt by typing 'ipconfig' in the command prompt.
Just follow the steps :
Step 1 : Open 'Run' in the START menu.
Step 2 : Type 'cmd' in the run tab.The command prompt will appear.
Step 3 : Type 'ipconfig' and press ENTER.
The ip address along with some other information will appear. 
The following program does the same : 

#include <iostream>

using namespace std;
int main()
{
    system("C:\\Windows\\system32\\ipconfig");
    cin.get();
    return 0; // halts the program until enter is pressed
} // end of main
Ip address of the host computer on windows 7



1 comments:

  1. Error "system was not declared in this scope"
    doesn't compile

    ReplyDelete

Comment Here....