I want to read only the IP's and printf them without blank spaces.Here is part of my code :
char buffer[256]
dns_serv = fopen("dns_servers.conf", "rt"));
log = fopen("logfile", "at")) ;
if (!fgets(buffer,sizeof(buffer), dns_serv)) {
break;
}
if (buffer[0] == '#') continue;
if (buffer[0] == '\n') continue;
if ((sockdns = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
printf("Error\n");
continue;
}
fprintf(log, "; %s - %s %s",buffer,argv[1], argv[2]);
This writes me on logfile :
; 141.85.128.1
- google.com SOA
but i want to write it on the same line:
; 141.85.128.1 - google.com SOA
Where is my mistake? Here is the dns_servers.conf:
# first example
141.85.128.1
# another
# 61.34.189.250