#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main() {
// ipconfig: IPv6 Address. . . . . . . . . . . : 2021:a83:85c3:0000:0000:1e2e:0180:7555
char IPv6Line[] = "IPv6 Address. . . . . . . . . . . :";
system("ipconfig > ip.txt");
FILE *IPFile = fopen("ip.txt", "r");
char line[80];
char line1 = 1;
while (fgets(line, sizeof(line), IPFile)) {
if (strstr(line, IPv6Line) != NULL && line1 == 1) {
line1++;
continue;
}
if (strstr(line, IPv6Line) != NULL) {
strcpy(line, line + 39);
puts(line);
fclose(IPFile);
}
}
return 0;
}
/*
run:
2021:a83:85c3:0000:0000:1e2e:0180:7555
*/