Share via


FNOPEN 매크로(fdi.h)

FNOPEN 매크로는 FDI 컨텍스트에서 파일을 열기 위해 애플리케이션 정의 콜백 함수에 대한 선언을 제공합니다.

구문

void FNOPEN(
  [in]  fn
);

매개 변수

[in] fn

파일 이름입니다.

반환 값

없음

설명

함수는 _open 유사한 매개 변수를 허용합니다.

예제

FNOPEN(fnFileOpen)
{
    HANDLE hFile = NULL;
    DWORD dwDesiredAccess = 0; 
    DWORD dwCreationDisposition = 0;

    UNREFERENCED_PARAMETER(pmode);

    if ( oflag & _O_RDWR )
    {
        dwDesiredAccess = GENERIC_READ | GENERIC_WRITE;
    }
    else if ( oflag & _O_WRONLY )
    {
        dwDesiredAccess = GENERIC_WRITE;
    }
    else
    {
        dwDesiredAccess = GENERIC_READ;
    }

    if ( oflag & _O_CREAT )
    {
        dwCreationDisposition = CREATE_ALWAYS;
    }
    else
    {
        dwCreationDisposition = OPEN_EXISTING;
    }

    hFile = CreateFileA(pszFile, 
                        dwDesiredAccess,
                        FILE_SHARE_READ,
                        NULL,
                        dwCreationDisposition,
                        FILE_ATTRIBUTE_NORMAL,
                        NULL);

    return (INT_PTR)hFile;
}

요구 사항

   
대상 플랫폼 Windows
헤더 fdi.h

추가 정보

FDI만들기