ePass1000 C/C++ API Reference Manual Version 2.0 |
The epas_CreateFile function create a file in the current directory. Applications must have changed current directory to the directory under which file is to be created by invoking epas_ChangeDir. Application must also have the proper privilege to create a file.
EPAS_STATUS EPAS_API epas_CreateFile( EPAS_HANDLE hContextHandle, // [in] unsigned long ulFlags, // [in] PEPAS_FILEINFO pFileInfo, // [in] unsigned long ulSizeOfFileInfo // [in] );
epas_CreateContext, epas_OpenDevice
You should first zero initialize this structure and set corresponding fields. See EPAS_FILEINFO structure.
It is recommended that application only create files under their own defined Application Directory and not under the root directory. To create an Application Directory, See the epas_CreateDir function.
File create operation will automatically close currently opened file, even if the file create failed.
File creation access is controlled through the Global Access Control. To obtain the Global Access Control, use the epas_GetProperty function. To set the Global Access Control, use the epas_SetProperty function.
For a list of reserved file IDs, see EPAS_FILEINFO.
If the function succeeds, FT_SUCCESS returned.
If file creation access is not granted, FT_ACCESS_DENIED is returned.
If a file with the given ID already exists, FT_ALREADY_EXISTS is returned.
If the free space of the device is not big enough to create the file, FT_NOT_ENOUGH_MEMORY is returned.
For a list of all return codes, see Status Return Values.
EPAS_STATUS epsRet; EPAS_HANDLE handle; EPAS_FILEINFO fi; ZeroMemory(&fi,sizeof(EPAS_FILEINFO)); fi.ulID = 0xEF03; fi.ucFileType = EPAS_FILETYPE_DATA; fi.ulFileSize = 50; fi.ucReadAccess = EPAS_ACCESS_ANYONE; fi.ucWriteAccess = EPAS_ACCESS_ANYONE; fi.ucCryptAccess = EPAS_ACCESS_ANYONE; epsRet = epas_CreateFile(handle,0,&fi,sizeof(EPAS_FILEINFO));. . . .
epas_DeleteFile, epas_OpenFile, epas_CloseFile, epas_GetFileInfo, epas_Read, epas_Write, epas_CreateDir, epas_DeleteDir, epas_GetCurrentDir, epas_ChangeDir, epas_Directory