Monday 17 September 2012

c program to get ip address



DESCRIPTION
This c program prints ip (internet protocol) address of your computer, system function is used to execute the command ipconfig which prints ip address, subnet mask and default gateway. The code given below works for Windows xp and Windows 7. If you are using turbo c compiler then execute program from folder, it may not work when you are working in compiler and press Ctrl+F9 to run your program.
C programming code
#include<stdlib.h>

main()
{
   system("C:\\Windows\\System32\\ipconfig");
   system("pause");

   return 0;
}
IP address program executable.
OUTPUT
WINDOWS IP CONFIGURATION
ETHERNET ADAPTER LOCAL AREA CONNECTION:
CONNECTION-SPECIFIC DNS SUFFIC.:
IP ADDRESS...........27.107.241.183
SUBNET MASK..........255.255.255.255
DEFAULT GATEWAY.........27.107.241.183

No comments:

Post a Comment