문자열을 나눈 후 나눈 값을 배열에 저장
int main(int argc, char **argv)
{
FILE *fp_out ;
char buf_in[255];
int TestX[10];
int TestY[10];
char *pToken = NULL;
char *pSeparator = " ";
int count =0, num= 0 ;
fp_out = fopen("Test.txt", "r");
while(fgets(buf_in, 255, fp_out) != NULL){
pToken = strtok(buf_in, pSeparator);
num = atoi(pToken);
TestX[count] = num;
pToken = strtok(NULL, pSeparator);
num = atoi(pToken);
TestY[count] = num;
count++;
}
fclose(fp_out);
}
반응형