|
char * 형식이랑 AnsiString 형식이 안맞아서그런거같은데요
tempfoldername_2 는 AnsiString 이고
foldername 은 char * 형이니;
만두박사 님이 쓰신 글 :
: 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;
: }
|