The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.
FNOPEN macro
The FNOPEN macro provides the declaration for the application-defined callback function to open a file in an FDI context.
Syntax
void FNOPEN( [in] LPSTR pszFile, int oflag, int pmode );
Parameters
- pszFile [in]
-
The name of the file.
- oflag
-
Specifies the type of operations allowed.
- pmode
-
Specifies the permission mode.
Return value
The return value is application-defined and used to identify the open file. However, a value of -1 indicates an error.
Remarks
The function accepts parameters similar to _open.
Examples
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;
}
Requirements
|
Header |
|
|---|
See also
Show: