Get IP Address in C++
To find/get and display the IP address of your computer in C++ programming, use the function system() and place the command ipconfig after providing the full path of System32 i.e., C:\\Windows\\System32\\ipconfiginside it which calls the windows Command Prompt (cmd) to find/get and display the IP address as shown here in the following program.
C++ Programming Code to Get IP Address
Following C++ program get the IP Address and display it on the screen:
/* C++ Program - Get IP Address */ #include<conio.h> #include<stdlib.h> void main() { clrscr(); system("C:\\Windows\\System32\\ipconfig"); getch(); }
When the above C++ program is compile and executed, it will produce the following result:
No comments:
Post a Comment