int pool_count=2
char dhcp_iprange[]="10.0.0."
char poolline[]=""
/* Construct the poollines */
while (pool_count!=253){
strcpy(poolline, pool_count);
strcat(poolline, ": :ipad=");
strcat(poolline, dhcp_iprange);
strcat(poolline, pool_count);
strcat(poolline, ":tblc=internal/n");
fputs(poolline,poolfile);
pool_count++;
}
fputs(poolline,poolfile);
Hej du kan bruge itoa funktionen så bliver det til :
int pool_count=2
char dhcp_iprange[]="10.0.0."
char poolline[]=""
char buffer[20];
/* Construct the poollines */
while (pool_count!=253){
_itoa(pool_count,buffer,10);
strcpy(poolline, buffer);
strcat(poolline, ": :ipad=");
strcat(poolline, dhcp_iprange);
strcat(poolline, buffer);
strcat(poolline, ":tblc=internal/n");
fputs(poolline,poolfile);
pool_count++;
}
fputs(poolline,poolfile);