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
[13533] Re:[질문]도저히 이해가 안감...
박지훈.임프 [cbuilder] 778 읽음    2001-12-11 00:50
file2 = ... 문장을 지우면,
file2 포인터는 초기화가 안되어 있으니 엉뚱한 값이 들어있을 수밖에 없지요.

그럼 이만...


webb 님이 쓰신 글 :
: 밑에 제가 질문한것을 혼자 풀어볼라고 이래저래 하다가 황당한(?)일을 겪고 있습니다.
:
: 원하는대로 되긴 했지만 이해가 안갑니다.
:
: void __fastcall TForm1::Button3Click(TObject *Sender)
: {
:   char* file;
:   char* file2;
:
:   OpenDialog1->Execute();
:   file = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=";
:   //ADOTable2->ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=";
:   //Edit1->Text =ADOTable2->ConnectionString;
:   strcat(file,OpenDialog1->FileName.c_str());
:   //Edit1->Text = file;
:   //ADOTable2->ConnectionString += WideString(OpenDialog1->FileName);
:   //Edit1->Text = ADOTable2->ConnectionString;
:   //ADOTable2->ConnectionString +=";Persist Security Info=False;Extended Properties=Excel 8.0";
:   file2 =";Persist Security Info=False;Extended Properties=Excel 8.0";
:   Edit2->Text = file2;
:   strcat(file,";Persist Security Info=False;Extended Properties=Excel 8.0");
:   //Edit1->Text =  file;
:   ADOTable2->ConnectionString = WideString(file);
:   Edit1->Text =  ADOTable2->ConnectionString;
:   ADOTable2->TableDirect = true;
:   ShowMessage(ADOTable2->ConnectionString);
:   ShowMessage(OpenDialog1->FileName);
:   ADOTable2->Active = true;
:
: }
: 중간에
:  file2 =";Persist Security Info=False;Extended Properties=Excel 8.0";
:  Edit2->Text = file2;
: 부분을 보면 Edit2->Text는 당연히  ;Persist Security Info=False;Extended Properties=Excel 8.0 가
: 되어야 하는데 엉뚱한 값이 나옵니다.
: 무엇이 나오냐 하면 opendialog에서 불러들은 파일의 경로와 파일이름이 약간 변형이 되서 나옵니다.
: 읽어들은 파일은 c:\documents and setttings\김규식\my documents\order.xls인데
: ":\documents and setttings\김규식\my documents\order.xls:"로 표시됩니다.
: 우째 이럴 수가 있나요?
:
: 그런데 더 우낀것은 일단 위 코드로 원하는대로 실행은 되나 만약 file2 = .... 문장을 지우면
: 원하는 문장 즉,
: Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\documents and setttings\김규식\my documents\order.xls;Persist Security Info=False;Extended Properties=Excel 8.0가 아니라
:
: Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\documents and setttings\김규식\my documents\order.xls:\documents and setttings\김규식\my documents\order.xls: 가 나온다는 겁니다.
:
: 제가 바본가요?.. 정말 이상하다...
:
:

+ -

관련 글 리스트
13524 [질문]도저히 이해가 안감... webb 763 2001/12/10
13533     Re:[질문]도저히 이해가 안감... 박지훈.임프 778 2001/12/11
13603         답변 감사합니다. webb 647 2001/12/12
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.