Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,877 questions

51,801 answers

573 users

How to get IP address in C

2 Answers

0 votes
#include <stdio.h>
#include <stdlib.h> 
 
int main() { 
    system("C:\\Windows\\System32\\ipconfig");
 
    return(0);
}
 
 
/*
run:
  
Windows IP Configuration
 
 
Ethernet adapter Ethernet:
 
   Connection-specific DNS Suffix  . :
   Link-local IPv6 Address . . . . . : ae00::6010:a000:5300:7101%3
   IPv4 Address. . . . . . . . . . . : 123.123.1.12
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . : 123.123.1.1
 
*/


answered May 22, 2015 by avibootz
edited Jul 14, 2020 by avibootz
0 votes
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

int main() {
   execl("c:\\windows\\system32\\ipconfig", "ipconfig", (char *)0);
   
   return 0;
}           
              
              
/*
run:
              
Windows IP Configuration


Ethernet adapter Ethernet:

   Connection-specific DNS Suffix  . :
   Link-local IPv6 Address . . . . . : ae00::6010:a000:5300:7101%3
   IPv4 Address. . . . . . . . . . . : 123.123.1.12
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . : 123.123.1.1
         
*/

 



answered Jul 14, 2020 by avibootz

Related questions

4 answers 205 views
205 views asked May 15, 2024 by avibootz
1 answer 173 views
173 views asked May 6, 2021 by avibootz
1 answer 213 views
1 answer 234 views
1 answer 89 views
2 answers 144 views
1 answer 161 views
161 views asked Feb 21, 2019 by avibootz
...