Share via


Macro FNOPEN (fdi.h)

A macro FNOPEN fornece a declaração para que a função de retorno de chamada definida pelo aplicativo abra um arquivo em um contexto FDI.

Sintaxe

void FNOPEN(
  [in]  fn
);

Parâmetros

[in] fn

O nome do arquivo.

Valor retornado

Nenhum

Comentários

A função aceita parâmetros semelhantes a _open.

Exemplos

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;
}

Requisitos

   
Plataforma de Destino Windows
Cabeçalho fdi.h

Confira também

FDICriar