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

델파이 Q&A
Delphi Programming Q&A
[7262] [답변] 벤자민/ 실행화일을 수정할려면..binary로 어케
박테리아 [ ] 1074 읽음    2000-07-14 17:48
안녕 하세요?

BacTeria 박종민 입니다.

델파이에서 바이너리 파일을 액세스 하기 위한 함수로는

FileOpen, FileClose, FileRead, FileWrite, FileSeek 등의 함수가 있습니다.

델파이의 도움말에 자세히 설명 되어 있으니 참고 하세요~

예제를 직접 올리지 못해 죄송합니다.

이만... 박종민...

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

{ 아래에 있는 내용은 델파이의 도움말 원문 입니다 }

FileOpen, FileSeek, FileRead Example
====================================

The following example uses a button, a string grid, and an Open dialog box on a
form. When the button is clicked, the user is prompted for a filename. When the
user clicks OK, the specified file is opened, read into a buffer, and closed. Th
en the buffer is displayed in two columns of the string grid. The first column c
ontains the character values in the buffer. The second column contains the numer
ic values of the characters in the buffer.

procedure TForm1.Button1Click(Sender: TObject);

var
  iFileHandle: Integer;
  iFileLength: Integer;
  iBytesRead: Integer;
  Buffer: PChar;
  i: Integer
begin
  if OpenDialog1.Execute then
  begin
    try
      iFileHandle := FileOpen(OpenDialog1.FileName, fmOpenRead);
      iFileLength := FileSeek(iFileHandle,0,2);
      FileSeek(iFileHandle,0,0);
      Buffer := PChar(AllocMem(iFileLength + 1));
      iBytesRead = FileRead(iFileHandle, Buffer, iFileLength);
      FileClose(iFileHandle);

      for i := 0 to iBytesRead-1 do
      begin
        StringGrid1.RowCount := StringGrid1.RowCount + 1;
        StringGrid1.Cells[1,i+1] := Buffer[i];
        StringGrid1.Cells[2,i+1] := IntToStr(Integer(Buffer[i]));
      end;
    finally
      FreeMem(Buffer);
    end;
  end;
end;


+ -

관련 글 리스트
7262 [답변] 벤자민/ 실행화일을 수정할려면..binary로 어케 박테리아 1074 2000/07/14
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.