Hash :
94046104
Author :
Thomas de Grivel
Date :
2020-02-24T15:19:27
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
/*////////////////
/STOCKAGE EXTERNE/
////////////////*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "iplist.h"
void write_iplist(char * ip)
{
FILE * ip_list;
ip_list = fopen("IP_server","a");
if( ip_list==NULL ) exit(1);
fputs(ip, ip_list);
fputc('\n',ip_list);
fclose(ip_list);
}
char * read_iplist(int nb)
{
FILE * ip_list;
char * ip;
ip = malloc(17*sizeof(char));
ip_list = fopen("IP_server","r");
if( ip_list==NULL ) exit(1);
while(nb)
{
fgets(ip, 17, ip_list);
nb--;
}
fclose(ip_list);
ip[strlen(ip)-1] = '\0';
return ip;
}