C++Builder Programming Forum
C++Builder  |  Delphi  |  FireMonkey  |  C/C++  |  Free Pascal  |  Firebird
볼랜드포럼 BorlandForum
 경고! 게시물 작성자의 사전 허락없는 메일주소 추출행위 절대 금지
C++빌더 포럼
Q & A
FAQ
팁&트릭
강좌/문서
자료실
컴포넌트/라이브러리
메신저 프로젝트
볼랜드포럼 홈
헤드라인 뉴스
IT 뉴스
공지사항
자유게시판
해피 브레이크
공동 프로젝트
구인/구직
회원 장터
건의사항
운영진 게시판
회원 메뉴
북마크
볼랜드포럼 광고 모집

C++빌더 Q&A
C++Builder Programming Q&A
[65443] AnsiString 꼬임 문제
만두박사 [minbaemandoo] 1093 읽음    2011-11-02 18:08
AnsiString이 꼬여서 원하는 문자가 제대로 입력되지 않고 있습니다.

else if(pop_num < 100)
         temp_foldername_2 = "experiment_0" + IntToStr(pop_num);

줄을 지나면 temp_foldername_2 가 "experiment_011"이 되어야 하는데,
자꾸 "istory matching" 이런 식으로 이상한 문자들이 들어가게 되네요.

무엇이 문제인지 알고 싶습니다.



int CreateFiles(char *foldername)
{
   int i;

   int popsize;
   popsize = 12;
   int pop_num;
   pop_num = 11;

   char *newpath;
   char *newfile;

   char *newpath2;
   char *foldername_2;

   newpath = "";
   strcat(newpath, foldername);

   // 새폴더 생성
   mkdir(newpath);

   for(i=0;i<popsize;i++)
   {
      // 새하위폴더명 생성
      if(pop_num < 10)
         temp_foldername_2 = "experiment_00" + IntToStr(pop_num);
      else if(pop_num < 100)
         temp_foldername_2 = "experiment_0" + IntToStr(pop_num);
      else if(pop_num < 1000)
         temp_foldername_2 = "experiment_" + IntToStr(pop_num);
      else
      {
         // Error!!
         // ShowMessage "Too many population!"
      }

      foldername_2 = "";
      foldername_2 = temp_foldername_2.c_str();

      // 새하위폴더 생성
      newpath2 = "";
      strcpy(newpath2, newpath);
      strcat(newpath2, "\\");
      strcat(newpath2, foldername_2);
      mkdir(newpath2);

      // 새파일명 생성
      newfile = "DATAFILE";
      strcat(newpath2, newfile);

      // 새파일 생성
      ofstream outfile1;
      outfile1.open(newfile);
      outfile1<<"MBH"<<" "<<"!!"<<endl;
      outfile1.close();
   }
   return 0;
}

+ -

관련 글 리스트
65443 AnsiString 꼬임 문제 만두박사 1093 2011/11/02
65448     Re:AnsiString 꼬임 문제 956 2011/11/02
65446     Re:AnsiString 꼬임 문제 아제나 893 2011/11/02
65444     Re:AnsiString 꼬임 문제 aa 922 2011/11/02
65445         Re:Re:AnsiString 꼬임 문제 만두박사 851 2011/11/02
65456             Re:Re:Re:AnsiString 꼬임 문제 김태선 1137 2011/11/04
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.