admin 发表于 2019-10-9 08:31:23

使用Ufun的CFI函数直接判断文件夹和文件等操作



在进行相关文件和文件路径判断时候,ufun提供了内置的方法。
UC4560 通过设置第二个 参数为 100 可以判断文件夹,通过设置 为 0 可以查找文件。




uc4560 (view source)

Defined in: uf_cfi.h


Overview

Checks whether the specified file of the given type exists.

NOTE: Mixed or upper case file names may not be found if the
environment variable UGII_OPTION = LOWER is set.

Passing an ftype of 0 will look for a file but does not work for a directory.
To check for a directory the ftype must be set to 100.


Return

Return code:
< 0 = Error
= 0 = File Exists
= 1 = File Does Not Exist


Environment

Internal and External


See Also

For description of file types see table


Required License(s)

gateway



int uc4560
(
const char * fspec,
int ftype

)


const char *fspecInputFile to check
intftypeInputFile type
0 will check for files
100 will check for directories



查找文件也可以通过UF_CFI_ask_file_exist

UF_CFI_ask_file_exist (view source)

Defined in: uf_cfi.h


Overview

Test if a file exists.

Note: This function only works with files - not directories. To check if a
directory exists use uc4560 and pass a file type of 100.


Return

0 - No error
Otherwise - Error Code


Environment

Internal and External


History

Originally released in V16.0


Required License(s)

gateway



int UF_CFI_ask_file_exist
(
const char * file_spec,
int * status

)


const char *file_specInputThe file to check
int *statusOutputFile existence status.
0 - file exists
1 - file does not exist



页: [1]
查看完整版本: 使用Ufun的CFI函数直接判断文件夹和文件等操作