while ( fgets ( line, sizeof line, file ) != NULL )
{ int idx, port; char ip[MAX_IP + 1];
sscanf(line, " %d %s %d", &idx, ip, &port);
strncpy(servers[idx-1], ip, MAX_IP + 1);
}
But, of course, if you are not sure about the correct input file, you should add error checking.
EDIT: " ", , , , . :
int idx, port; char ip[MAX_IP + 1];
while (3 == fscanf(file, " %d %s %d", &idx, ip, &port))
memcpy(servers[idx-1], ip, MAX_IP + 1);
, memcpy , strcpy, , ip-...