ePass1000 C/C++ API Reference Manual Version 2.0

# epas_Read

The epas_Read function returns content of the current opened file at a given offset. Application need read access privilege to the file to invoke this function successfully.

    EPAS_STATUS EPAS_API
    epas_Read(
        EPAS_HANDLE hContextHandle,       // [in]
        unsigned long ulFlags,            // [in]
        unsigned long ulOffset,           // [in]
        unsigned char* pucBuffer,         // [out]
        unsigned long ulBytesToRead,      // [in]
        unsigned long* pulBytesRead       // [out]
    );

#### Requirement

epas_CreateContext, epas_OpenDevice, epas_OpenFile or epas_CreateFile

#### Parameters

hContextHandle
  [in]Pointer to handle of a device context.
ulFlags
  [in] Reserved for future extension. Must be set to zero.
ulOffset
  [in] A zero-based value defining the relative distance from the beginning of the file.
pucBuffer
  [out Pointer to a buffer that retrieves data read from the file.
ulBytesToRead
  [in] Specifies the number of bytes to read.
pulBytesRead
  [out] Pointer to a variable which returns the number of bytes actually read from the file. This parameter can NOT be NULL.

#### Remarks

Property access rights is required to read a file successfully. The granted access setting and file type is returned from the epas_OpenFile function in the EPAS_FILEINFO structure.

#### Return Values

If the function succeeds, FT_SUCCESS returned.

If read access to the file has not granted, FT_ACCESS_DENIED returned.

For a list of all return codes, see Status Return Values.

#### Sample Code

    EPAS_STATUS epsRet;
    EPAS_HANDLE handle;
    .
    .
    .
    unsigned long ulReaded;

    epsRet = epas_Read(	handle,0,0,pBuf,fi.ulFileSize,&ulReaded);
    .
    .
    .

#### See Also

epas_CreateFile, epas_DeleteFile, epas_OpenFile, epas_CloseFile, epas_GetFileInfo, epas_Write, epas_CreateDir, epas_DeleteDir, epas_GetCurrentDir, epas_ChangeDir, epas_Directory