int FileLoad(Function ** functionDiary)
{
 int i, j;
 int allFunctionNum=0;
 char tempstr[2000];
 char fH[100], fR[100], fN[100], fP[100], fI[1600];
 FILE * fp = fopen("data.txt", "rt");
 printf("파일 준비중...\n");
 if (fp != NULL)
 {
  printf("파일 준비 완료...\n");
  while (1)
  {
   if (fgets(tempstr, 2000, fp) >0)
   {
    for (i = 0; i < 2000; i++)
    {
     if (tempstr[i] == '[' )
     {
      if (tempstr[i + 1] == '1')
      {
       if (tempstr[i + 2] == ']')
       {
        for (j = 0; tempstr[i+3+j] != '[';j++)
        {
         fH[j] = tempstr[i + 3 + j];
        }
        fH[j] = 0;
        i += j;
       }
      }
     }
     if (tempstr[i] == '[')
     {
      if (tempstr[i + 1] == '2')
      {
       if (tempstr[i + 2] == ']')
       {
        for (j = 0; tempstr[i + 3 + j] != '['; j++)
        {
         fR[j] = tempstr[i + 3 + j];
        }
        fR[j] = 0;
        i += j;
       }
      }
     }
     if (tempstr[i] == '[')
     {
      if (tempstr[i + 1] == '3')
      {
       if (tempstr[i + 2] == ']')
       {
        for (j = 0; tempstr[i + 3 + j] != '['; j++)
        {
         fN[j] = tempstr[i + 3 + j];
        }
        fN[j] = 0;
        i += j;
       }
      }
     }
     if (tempstr[i] == '[')
     {
      if (tempstr[i + 1] == '4')
      {
       if (tempstr[i + 2] == ']')
       {
        for (j = 0; tempstr[i + 3 + j] != '['; j++)
        {
         fP[j] = tempstr[i + 3 + j];
        }
        fP[j] = 0;
        i += j;
       }
      }
     }
     if (tempstr[i] == '[')
     {
      if (tempstr[i + 1] == '5')
      {
       if (tempstr[i + 2] == ']')
       {
        for (j = 0; tempstr[i + 3 + j] != '\n'; j++)
        {
         fI[j] = tempstr[i + 3 + j];
        }
        fI[j] = 0;
        i += j;
       }
      }
     }
    }
    functionDiary[allFunctionNum] = ReturnFunction(allFunctionNum, fH, fR, fN, fP, fI);
    printf("파일 로드중...%d\n", allFunctionNum++);
   }
   else
   {
    if (feof(fp) != 0)
    {
     printf("파일 로드 완료...\n");
     fclose(fp);
     return allFunctionNum;
    }
    else
    {
     printf("ERROE! : f(fp) == 0\n");
     fclose(fp);
     return -1;
    }
   }
  }
 }
 else
 {
  printf("ERROE! : fp == NULL\n");
  fclose(fp);
  return -1;
 }
}


ㅅㅂ 내가 짠 코드지만 바로 다음날만 되도 몬소린지 모를거같다.


for if while천지


막 처음에는 최대한 간결하게 해야지 하는데 중간에 안돼서 코드 수정하고 그러다 보면 저꼴 나있음....


코딩 예쁘고 간결하게하는 방법론 같은거 없나