dns 소스 (1) 썸네일형 리스트형 strtok를 이용한 후, strcpy를 하였을 때, 쓰레기 값 발생문제 아래와 같이 Source를 참고하여 보자. int SUI_ToolControl_Get_DNS(void) { FILE *fp = fopen("/etc/resolv.conf", "rb"); char DNS_AA[20]; char s1[] = "dd"; char s2[] = " "; char temp[] = " "; char* token = NULL; int i = 0; if(fp == NULL) { printf("DNS /etc/resolv.conf file error\n"); return -1; } while(fgets(DNS_AA, 100, fp) != NULL) { strcpy(s1, DNS_AA); i++; } token = strtok(s1, s2); while(token != NULL) { pri.. 이전 1 다음