|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
& d8 n& u( t6 J$ F
) s' J( d5 J2 [在进行相关文件和文件路径判断时候,ufun提供了内置的方法。
, L0 y s# i' I8 o, e9 A1 `7 [UC4560 通过设置第二个 参数为 100 可以判断文件夹,通过设置 为 0 可以查找文件。
, L, k" l0 ~( B1 G$ G
8 J" ~3 Z! i4 k4 u% n% g
) F2 P B2 T1 Z& A7 ~# y4 N- J
& F5 I: R$ A& u# T
5 v$ V1 o% P) P- E9 ruc4560 (view source)
) m) J" H' R2 ]3 Z5 t
9 D" `' j5 I8 _. R# r" a2 ADefined in: uf_cfi.h: ~4 P9 B6 u4 H+ b! Z6 v' w4 [
0 D5 R1 f) Y' s8 q, `3 z @3 h2 c$ G) C. }* s6 f- e
Overview
+ S Q' M, z& P. X$ Q5 V8 s) b# q: b$ Y# Y# c/ p
Checks whether the specified file of the given type exists.
/ O- ?' ]2 L% @2 R) \. m
# G* D" _/ _3 S7 r7 ^4 mNOTE: Mixed or upper case file names may not be found if the
! K- _3 l1 H8 F6 uenvironment variable UGII_OPTION = LOWER is set.% ^- a, T2 K( w" h
1 o+ i, M( ~* _) [% h3 b
Passing an ftype of 0 will look for a file but does not work for a directory.9 {8 o: ]& Z6 K8 `
To check for a directory the ftype must be set to 100.; Q- h8 t7 F6 _- M2 \; n" w
, r( i) i& Y. {# K7 I, P
% j' Z, U4 @$ d8 NReturn/ a9 `$ H: Z- ?0 N K
# `' d$ B1 C( o8 PReturn code:3 n1 G8 U) _1 R* e0 ^* Y# @/ |
< 0 = Error" Q; o* f/ E I8 G, b8 A0 ^& }
= 0 = File Exists
! u9 G1 m8 [; |& f( b' Q- b= 1 = File Does Not Exist
1 L& W9 V- r. F1 k8 O2 f; _6 v) U2 m
- `3 ^9 g+ L [* PEnvironment
, Q% y' y8 D) p: i# }" G
! l. I6 L3 ~7 u, P, ]0 M& IInternal and External
- Q, ~! m2 s( y) K9 }
+ E( R- b9 I" w# [$ L
1 Y, w- N6 v0 e0 t. e, cSee Also
7 p, C% z* ^8 U; Q: s/ \' ]9 b/ J1 F8 A& Y' E7 M
For description of file types see table
- H9 s W3 G* I3 H ! F5 p5 f- {/ f! p. Z
# S0 v0 d2 u$ |# t$ B1 V7 t9 w I2 q
Required License(s)# |( N1 ^2 \! s5 ?, g- v
% e5 g3 v: F2 {' Z6 @gateway2 l" m) I- r1 x
4 l9 K6 B4 j0 J7 m. W& ], l" V |7 n* o: `( z# O' D
0 ^+ _2 U3 M8 e; `int uc4560) f, a% c5 z7 j6 R; d
(2 I* M2 \) W6 y: h
const char * fspec,$ I" V% O X% m o, c
int ftype
9 @1 f7 F& E7 W. r8 s* t
: D+ c" s# @/ c)
8 A n+ ]" U# t% O1 v
9 ~3 c2 K3 x+ E4 e+ }| const char * | fspec | Input | File to check | | int | ftype | Input | File type, @' U# g% V8 u2 O
0 will check for files3 A3 A% z( G) }8 f2 P6 c3 p& I5 h
100 will check for directories |
7 t2 \- P# H& N8 c
" D( k! D; v) m+ [# f! m- d
5 Q3 M4 [% q |7 N! `0 Y3 y查找文件也可以通过UF_CFI_ask_file_exist6 o& t1 Z$ j& }: E* y/ k
' `; K) m! V$ f3 q; v7 H3 S
UF_CFI_ask_file_exist (view source)+ f( `! M0 h$ S& V/ p
3 J+ K3 Z9 I4 MDefined in: uf_cfi.h
: Z6 m. `7 \1 _5 t# B- e
& @2 b3 \# u" k3 I4 f9 z, O+ s, _0 N1 s3 v1 r$ C
Overview* O2 Z6 D& G+ E& e- V" E/ a
$ }2 ?+ b1 [7 @5 {( j& YTest if a file exists.
W+ ?! S, k `! U- [& s4 | o
/ M/ a8 k- Y0 ~+ I2 xNote: This function only works with files - not directories. To check if a
$ L* l* o& C/ i1 ]: Ldirectory exists use uc4560 and pass a file type of 100./ B5 `7 `4 f3 N
# D. }' h8 k' D( [
8 N, S4 Q0 y2 g0 d4 y' V dReturn
; z1 d0 U; y$ ~, ?4 h) _% ]4 U1 z" E# o: i$ u5 j
0 - No error
4 _" e4 j: f) ]: LOtherwise - Error Code
% y, b! {' x: x- k/ Y S, F
& p4 L0 v/ F N& A4 y- o) r: m- O
. Z( U3 e' _& [7 Q' V4 {" t& X jEnvironment% ]8 m. K6 U3 V, m6 ]
, B) I g0 U6 J( h4 a9 {Internal and External
2 s% W/ ?- Y3 M& }( h6 R, E* j* q# [- E8 B: X
1 [' D8 N3 K+ V, O; @, B ZHistory# k+ i4 i: s: d: h* m. s
% q* n: y; ?2 `Originally released in V16.0
) o- H9 M8 R+ _7 L# r* X! B( \9 D5 Z. Y * M. h5 b- o) C6 J
! s- Y3 t( b8 O+ l. U! vRequired License(s)4 j2 U0 S5 |0 \+ q. y* A0 V
9 o1 v4 O* G" S/ F
gateway
" s$ u- X. N5 O# X9 g3 {% Q6 Q/ g2 ?* _% p' B2 A
9 ~. {9 j, P* n; @
: f5 s+ g9 Y/ sint UF_CFI_ask_file_exist6 Z& Z0 m1 P& `/ p5 w
(
( w" r: T; B( k' f7 [: t' Qconst char * file_spec,3 S- @7 y; j4 E- ]2 I
int * status
6 N7 Q7 p( S% ^8 y, D+ C/ p! ~
8 E H! S2 c. i' f7 X( ]7 Q2 I)
$ z9 C, B( L. R5 {5 ^
7 v/ I* D7 {3 J" t( Y" h, P z- @| const char * | file_spec | Input | The file to check | | int * | status | Output | File existence status.
1 j- }3 f8 D5 c7 L) X0 - file exists
/ b3 m+ v4 a' E; x# F3 S, p' B1 - file does not exist% B) o; \) T' ?/ D# j
/ r& r m' D N& [" o' {) E/ | |
$ o0 X; ]" R) m( ?: ?0 u |
|