|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
t2 {$ @, _# C$ x: I
/ y: C3 U1 Y% Q
在进行相关文件和文件路径判断时候,ufun提供了内置的方法。. s2 K. c. e& L6 e7 t# H% M5 g
UC4560 通过设置第二个 参数为 100 可以判断文件夹,通过设置 为 0 可以查找文件。
8 g' R2 ?1 q8 J! w3 R8 m0 }1 L
8 `/ p& M$ k' L& e c. E- J& j5 e; p; T6 N3 t9 u4 g; s
" n% d& C; D5 a+ Z* [# r
: ~7 Y8 j0 C4 K8 J6 quc4560 (view source)
6 t1 T5 S! D6 d9 P9 h" g
' t8 \6 T5 w" zDefined in: uf_cfi.h7 s, K/ `7 i7 h
5 U7 x! X' D( O5 V
, M6 y2 t; s0 Y4 j2 HOverview
: ^2 p* h+ O% t9 v
( e0 z! i- Z4 R- a+ vChecks whether the specified file of the given type exists.
) v, l" k+ k) \0 n! @! i* C( v- J. o5 V4 R. P$ ]9 r/ Z
NOTE: Mixed or upper case file names may not be found if the
/ Z; \& q8 d$ _- `/ G4 @environment variable UGII_OPTION = LOWER is set.: z' a% V9 {& e0 y, p9 M1 |, `: f! ~. {
) v7 M9 n. [0 A8 B- aPassing an ftype of 0 will look for a file but does not work for a directory.# ?4 V! @( S* [& K3 ]
To check for a directory the ftype must be set to 100.1 z+ `$ C0 m6 n+ v1 o6 y
' q4 x* ~' d& g* z7 ?( T; J1 b2 m/ E# A* L [1 @" m
Return
: ~ m( g+ o% n& O
" \8 p- Q* ]$ _: {* U. n. X# E0 |& pReturn code:- A$ ] T1 l8 J3 {) k4 h
< 0 = Error
& [ L- t* L$ G( y/ y2 k4 X& W= 0 = File Exists
+ \. h3 r+ J/ _= 1 = File Does Not Exist
' D$ b0 c @9 g e+ h* l5 f% Q3 b8 ~0 d* P% w, D
2 \/ n8 P# Q& K( t+ a1 r/ P" WEnvironment
% I! V& A, ]6 C4 g" E0 N: i( A: l+ l8 j) c& L [- O/ P+ |
Internal and External! j. J; t; g+ d0 O( ^6 v; f
( y ?/ `# z' W" g, Q/ U% u$ s3 K
6 o; y# k0 N8 I" z' V, y- _6 U, HSee Also5 w1 g2 \9 Q, g5 x/ Q2 S
( p5 I- D6 \' ^! y! tFor description of file types see table
! ~) @ N( u9 c2 _8 H+ `4 M" v 7 j/ q7 c: h+ q: X6 f1 H- F+ [
# E" |9 B, Q* b5 V: c2 _Required License(s)4 [! m* Z! N# m: E. ?
' x6 r& i5 Y( ~/ L* N+ ?gateway0 U" B+ B, c! }6 M2 c; p% ^
2 r! U# W& b9 g% S4 e5 [/ i5 Z1 q+ f+ t5 T' A' c# T
R8 S' X% G6 w/ \$ C! `7 Q) [int uc4560' \# ?( M1 R( [ \4 F8 R
(
8 ]. F4 p# a E$ oconst char * fspec,
/ k* r6 ?9 t: B ]6 O/ r1 @int ftype
7 J5 w3 B1 M: s+ v
3 d: `" x( L! \8 `/ M)& r4 g7 _2 @! B m
* h2 |0 Q1 Y- ]
const char * | fspec | Input | File to check | int | ftype | Input | File type6 }8 R( V+ z) i9 A' O$ m
0 will check for files
) `. B. X1 U4 @% K9 f+ _$ l100 will check for directories | ' z( ^, z- G' O4 ?
$ L; r7 V y, N) ~
9 \/ T$ A! l( a' u6 P6 K- f! p* c查找文件也可以通过UF_CFI_ask_file_exist8 v: @# ?( G! S+ H1 }
8 n: A& W# o9 N$ Y# ~
UF_CFI_ask_file_exist (view source)
0 s; e, s# N& q. l
2 _9 D% n* z4 |% ]! hDefined in: uf_cfi.h
; V6 m) u- H3 D1 O$ E . }( X8 V$ _, ?6 q7 \7 ^
) N% K* D7 l2 Y3 {; Q* V+ |) }Overview
4 U7 S+ u, d/ ~8 S. D) A4 |- X5 T9 w& e* f7 C9 B7 k9 |
Test if a file exists.
- ~: _3 F r" R, ^3 Y1 P7 @( F6 H3 W7 d- q' w) u/ `+ T
Note: This function only works with files - not directories. To check if a4 h% K) F9 q6 q0 ]& ]
directory exists use uc4560 and pass a file type of 100.( t, J0 z! i' `
" j/ X+ z: t8 U8 Q4 H; y8 w: I2 }/ G1 I1 r) `9 c" z$ u+ k6 `) g
Return' m8 {! a5 t; n% b1 n, y
1 Q. W4 R2 Q$ h, H i0 - No error
) Q, F: Y) K3 QOtherwise - Error Code6 v5 h% M# s( I2 m0 E+ k
9 R$ w" `5 q! @1 o: b# a9 B" c% `, g' u) f. E0 j7 X
Environment- Y3 I! S! T5 `9 c( [
1 D# |, ]2 @- l2 c0 M/ s K7 k
Internal and External
1 r2 S6 y1 o( P3 f4 J! D/ h3 _
: x* ^1 I. U1 A9 s# ^$ s7 o) ~& M3 A. l2 y2 _# X! e# Q
History
8 E& ~3 ^& l7 t: B2 j0 B: R1 i: u. }9 M* H5 U* |
Originally released in V16.0
/ V6 u. t+ V0 r! K5 y ! L8 n, m- s9 \2 y+ z
* y) z, M8 \) \4 s% v( z' A
Required License(s)" v- N! P P t( A
+ s% H. x8 q) @/ p: a& ^gateway/ U& Y& V3 y% a2 l! L8 I% S2 M) a
# ~1 E% H+ z4 i k. F" _ ]
! f# ]% ], m, Y
" W" T8 b5 _4 w) a( b5 \int UF_CFI_ask_file_exist
1 g7 g' u! S* c(
: ~( b4 m$ {' sconst char * file_spec,6 C2 E- b7 f3 p0 ^( t
int * status: g/ r( p7 y; p: q
% C* G% v o) o; ~* ~8 z)
; ^1 k; R& a; H8 A l3 B+ `* `. D2 _( H% Z$ F8 j
const char * | file_spec | Input | The file to check | int * | status | Output | File existence status.0 q' W. {0 ?$ H4 n, D7 H
0 - file exists: o' O5 v$ P. t8 d9 X
1 - file does not exist0 P) b/ Q B" ^* t
, u8 i2 @$ C! h+ G: y |
- U' G# D5 r1 V" k. Q8 {" C |
|