#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main() {
// ipconfig: IPv4 Address. . . . . . . . . . . : 101.11.1.111
char IPv4Line[] = "IPv4 Address. . . . . . . . . . . :";
system("ipconfig > ip.txt");
FILE *IPFile = fopen("ip.txt", "r");
char line[80];
while (fgets(line, sizeof(line), IPFile)) {
if (strstr(line, IPv4Line) != NULL) {
strcpy(line, line + 39);
puts(line);
fclose(IPFile);
}
}
return 0;
}
/*
run:
101.11.1.111
*/