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
[44656] Re:소켓통신으로 폴더와 폴더안에 있는 파일들을 전송하는 걸 모르겠어요...ㅜㅜ;...
ayh [] 1576 읽음    2006-04-28 15:20
원하는 디렉토리안의 파일들을 찾아내는 방법을 원하시는 듯 합니다. 디렉토리 안의 파일들의 목록을 알게 되면 당연히 각 파일별로 전송을 반복하시면 될 듯 하네요.

TSearchRec, FindFirst, FindNext, FindClose 를 사용해서 원하시는 디렉토리 안의 파일, 하위 디렉토리를 읽어올 수 있습니다.

Delphi Help 파일에서 해당 예제를 복사했습니다. Edit1->Text가 원하는 디렉토리를 가리키는 것으로 기억합니다.
더 필요한 내용은 검색을 해보시면 어떨까 생각되네요.

-------------------------------------------------------------------------------------------------
The following example uses an edit control, a button, a string grid, and seven check boxes. The check boxes correspond to the seven possible file attributes. When the button is clicked, the path specified in the edit control is searched for files matching the checked file attributes. The names and sizes of the matching files are inserted into the string grid.

void __fastcall TForm1::Button1Click(TObject *Sender)

{
  TSearchRec sr;
  int iAttributes = 0;
  StringGrid1->RowCount = 1;
  iAttributes |= faReadOnly * CheckBox1->Checked;
  iAttributes |= faHidden * CheckBox2->Checked;
  iAttributes |= faSysFile * CheckBox3->Checked;
  iAttributes |= faVolumeID * CheckBox4->Checked;
  iAttributes |= faDirectory * CheckBox5->Checked;
  iAttributes |= faArchive * CheckBox6->Checked;
  iAttributes |= faAnyFile * CheckBox7->Checked;
  StringGrid1->RowCount = 0;
  if (FindFirst(Edit1->Text, iAttributes, sr) == 0)

  {
    do
    {
      if ((sr.Attr & iAttributes) == sr.Attr)
      {
        StringGrid1->RowCount = StringGrid1->RowCount + 1;
        StringGrid1->Cells[1][StringGrid1->RowCount-1] = sr.Name;
        StringGrid1->Cells[2][StringGrid1->RowCount-1] = IntToStr(sr.Size);
      }
    } while (FindNext(sr) == 0);
    FindClose(sr);
  }
}

-------------------------------------------------------------------------------------------------

김민재 님이 쓰신 글 :
: 요즘 소켓으로 파일을 주고받는 프로그램짜고 있습니다...
: 파일을 전송건 돼는데....
: 폴더와 폴더안의 파일을들 전송한는건 도데체 모르겠습니다...
: 어떻게 해야하는지요?,,,불가능한건 아니겟죠?....^^;..
: 잘하시는 분들의 조언 부탁드립니다....
: 또 예제나 샘플프로그램 있으면 부탁드립니다....
: 그럼 수고하세요....

+ -

관련 글 리스트
44653 소켓통신으로 폴더와 폴더안에 있는 파일들을 전송하는 걸 모르겠어요...ㅜㅜ;... 김민재 1040 2006/04/28
44656     Re:소켓통신으로 폴더와 폴더안에 있는 파일들을 전송하는 걸 모르겠어요...ㅜㅜ;... ayh 1576 2006/04/28
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.