Q&A

  • File을 share mode로 open하는 방법
fStream := TFilestream.create(filename, fmOpenRead);

와 같이 파일을 읽어서 thread에서 처리하니깐..

file open error가 발생하는 경우가 있었어요...



여러개의 thread에서 동일파일을 읽기전용으로만 열때에

fmopenRead말고 어떤 값을 주어야 하나요?

1  COMMENTS
  • Profile
    정지호 2000.07.11 19:07
    김윤아 wrote:

    > fStream := TFilestream.create(filename, fmOpenRead);

    > 와 같이 파일을 읽어서 thread에서 처리하니깐..

    > file open error가 발생하는 경우가 있었어요...

    >

    > 여러개의 thread에서 동일파일을 읽기전용으로만 열때에

    > fmopenRead말고 어떤 값을 주어야 하나요?



    델파이 도움말에 있는 내용입니다. 참고하세용(맞는건지는 확실히 모르겠지만요)

    그럼 수고하세요

    Unit



    SysUtils

    File open mode constants are used to control the access mode to a file or stream.



    const fmOpenRead = $0000;

    const fmOpenWrite = $0001;

    const fmOpenReadWrite = $0002;

    const fmShareCompat = $0000;

    const fmShareExclusive = $0010;

    const fmShareDenyWrite = $0020;

    const fmShareDenyRead = $0030;

    const fmShareDenyNone = $0040;



    Description



    The file open mode constants are used to control the shareability of a file or stream when opened.

    TFileStream.Create has a Mode parameter that you can set to one of these constants:



    Constant Definition

    fmOpenRead Open for read access only.

    fmOpenWrite Open for write access only.

    fmOpenReadWrite Open for read and write access.

    fmShareCompat Compatible with the way FCBs are opened.

    fmShareExclusive Read and write access is denied.

    fmShareDenyWrite Write access is denied.

    fmShareDenyRead Read access is denied.

    fmShareDenyNone Allows full access for others.