Compartilhar via


Macro FNFCIOPEN (fci.h)

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

Sintaxe

void FNFCIOPEN(
  [in]  fn
);

Parâmetros

[in] fn

O nome do arquivo.

Retornar valor

Nenhum

Comentários

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

Exemplos

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

    UNREFERENCED_PARAMETER(pv);
    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);

    if ( hFile == INVALID_HANDLE_VALUE )
    {
        *err = GetLastError();
    }

    return (INT_PTR)hFile;
}

Requisitos

Requisito Valor
Plataforma de Destino Windows
Cabeçalho fci.h

Confira também

FCICriar