FNFCIWRITE macro

The FNFCIWRITE macro provides the declaration for the application-defined callback function to write data to a file in an FCI context.

Syntax


UINT FNFCIWRITE(
   INT_PTR  hf,
   void FAR *memory,
   UINT     cb,
   int FAR  *err,
   void FAR *pv
);

Parameters

hf

An application-defined value used to identify the open file.

memory

Pointer to the buffer containing the data to be written.

cb

The maximum number of bytes to be written.

err

Pointer to the error code value. This value is used when providing extended error information in the ERF structure used to create the FCI context.

pv

Pointer to an application-defined value.

Return value

The indicated callback function returns the number of bytes written. However, a value of -1 indicates an error.

Remarks

The function accepts parameters similar to _write.

Examples


FNFCIWRITE(fnFileWrite)
{
    DWORD dwBytesWritten = 0;

    UNREFERENCED_PARAMETER(pv);

    if ( WriteFile((HANDLE)hf, memory, cb, &dwBytesWritten, NULL) == FALSE )
    {
        dwBytesWritten = (DWORD)-1;
        *err = GetLastError();
    }

    return dwBytesWritten;
}


Requirements

Header

Fci.h

See also

FCICreate

 

 

Show: