ePass1000 C/C++ API Reference Manual Version 2.0 |
The epas_OpenFile function opens the file that associated with the given file ID in the current directory.
EPAS_STATUS EPAS_API epas_OpenFile( EPAS_HANDLE hContextHandle, // [in] unsigned long ulFlags, // [in] unsigned long ulFileID, // [in] PEPAS_FILEINFO pFileInfo, // [out] unsigned long ulSizeOfFileInfo // [in] );
epas_CreateContext, epas_OpenDevice, epas_ChangeDir
Flag | Meaning |
---|---|
0 | Open the file. The file access mode is based on the currently granted access privilege of the file. |
EPAS_FILE_READ | Open the file for reading. |
EPAS_FILE_WRITE | Open the file for writing. |
EPAS_FILE_CRYPT | Open the file for cryptographic operations. |
The file information is returned upon a successful open. You should first zero initialize this structure before calling the function. You may ignore this parameter by set the value to NULL.
The file access right depends on access setting of the file and current Security State of the device. For example, if the file write requires a USER PIN access, the write privilege is only granted in User State or SO State.
The granted access setting of the file is returned in the EPAS_FILEINFO structure upon a successful open. To retrieve the granted access rights of a file, use a flag of zero.
To obtain access setting of a file, use epas_GetFileInfo.
epas_OpenFile automatically closes current opened file, even if failed to open the specified file.
Upon a successful creation of a directory, the current directory will be set to the newly created directory.
For a list of reserved directory IDs, see EPAS_FILEINFO.
If the function succeeds, FT_SUCCESS returned.
If the specified file does not exist, FT_FILE_NOT_FOUND is returned.
For a list of all return codes, see Status Return Values.
EPAS_STATUS epsRet; EPAS_HANDLE handle; . . . epsRet = epas_OpenFile( handle,0,DEMO_FILE_ID,&fi,sizeof(EPAS_FILEINFO)); . . .
epas_CreateFile, epas_DeleteFile, epas_CloseFile, epas_GetFileInfo, epas_Read, epas_Write, epas_CreateDir, epas_DeleteDir, epas_GetCurrentDir, epas_ChangeDir, epas_Directory