|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
2 n& a- D0 U% d f$ m6 C9 g8 [$ @% i
在进行相关文件和文件路径判断时候,ufun提供了内置的方法。8 R! u" R) L' L, C( v/ n
UC4560 通过设置第二个 参数为 100 可以判断文件夹,通过设置 为 0 可以查找文件。8 t; X% q3 V0 P! t/ W* W
) u' K9 U2 ^/ U1 {, p
) P6 |$ Q5 V2 ^% l1 f$ j- O, p, _0 J* D% @& W F; C& Q' a
6 E1 k' u7 \. ]' Cuc4560 (view source)
- H* B8 q. ]0 c! U& K; P7 h% z
5 i) Q+ b3 |* UDefined in: uf_cfi.h1 s* D5 i+ {( v( E
! P; x {% Z) O1 o2 E* x7 L9 a) R, `9 c: @
Overview& V/ _; x# E9 S# c0 `" ^
1 G. Z/ l$ W2 Q+ d+ WChecks whether the specified file of the given type exists.
" k! [# P* z- U4 } n' \0 I( z; n4 Q" m8 j; j
NOTE: Mixed or upper case file names may not be found if the7 Q1 F7 L- r( W* d/ [" G6 F
environment variable UGII_OPTION = LOWER is set.- e+ M4 y# k7 u& a( G+ B
( m. |6 [$ x& ^' \8 \- F" N1 kPassing an ftype of 0 will look for a file but does not work for a directory.# n% Q* r' E. U& O
To check for a directory the ftype must be set to 100.4 C" y' f) C' z" P, f4 ^5 r+ X
1 A s, S' ^3 J1 d; }
. H& X4 K8 ^6 C K8 L- vReturn
, D$ f! D( U$ B, A6 M* P: K5 O/ t% _. ]4 f: C
Return code:
- u) r! l3 z: T7 _# q< 0 = Error
[0 G+ o2 v c= 0 = File Exists! S, p b2 v5 Q+ q( e
= 1 = File Does Not Exist/ P9 l, f/ O; \3 {% i
( N. z2 H! V* g" M9 P. R# M
4 d8 C. w# o# b; dEnvironment
: J! s2 k' b' f0 J3 e0 ^" Z
% ~0 Y- C( R- ~/ t: x( O( n% fInternal and External# J. C/ ?8 j7 ] q
! C* i$ T, f0 K) [; d# j* X
4 u" k7 x* o: |4 P- s$ G
See Also
' N" v) j% n( |3 x. h. k' L9 r5 E( P/ m! [" x9 j
For description of file types see table
- E9 R' p9 C0 y8 t! w [ 6 i* R, W' t' P% n8 w2 m6 W, V
4 Y) Q7 a# b; T \' bRequired License(s)9 o, Z8 G% D! k7 u6 Z0 C8 H, p
4 c/ N, q) `$ j' |gateway
- u$ Y: ^% Y. h
7 m5 \- ^9 v' ^( S: s3 B3 m0 M; s
+ T/ U0 @! q1 T# p% r [int uc4560
: s8 `7 ?" K% y% I) y(
) F& H, s! U& R; c% Q/ uconst char * fspec,3 F Z1 A5 ?' J' t
int ftype8 B$ B3 p/ }+ O
6 Q7 E* X1 Q* S' c! ^' D
)
5 r& L3 j3 {1 V' g/ o- m" m4 [- V9 N; x8 @$ ?0 L+ b% ~
const char * | fspec | Input | File to check | int | ftype | Input | File type
% }7 M0 x: P. C# a0 h, G* f0 will check for files5 v: b% E8 v& O' V6 m0 P
100 will check for directories |
1 Z5 o6 S4 {% n* J1 A) b# s0 ^, `2 ~- f: _9 h6 V1 B2 C
2 r' F4 T R8 y$ A, b查找文件也可以通过UF_CFI_ask_file_exist
# ^2 h. @! m9 H8 [7 g" p$ R, o5 H: X% d0 j1 n1 y7 t
UF_CFI_ask_file_exist (view source), P0 J1 B x) o& ?$ G5 @3 W
& v" r9 J+ r! r4 pDefined in: uf_cfi.h) q P) y( w F4 Z
+ }& M) j o- J. X
; x6 _0 B2 y0 U5 s( AOverview# v4 a) W* i& z
[0 I9 P6 v! ^0 O% F0 W
Test if a file exists.* d v' k; h0 c" L0 d! g p
" o7 V0 A0 U) A, |4 T( r CNote: This function only works with files - not directories. To check if a
1 M+ ?( A% D) G" L4 A* [directory exists use uc4560 and pass a file type of 100.
. d3 j K' W7 e/ n9 m. y1 E& e# n; G u
+ i: G% W, [) C% |- [1 i& x
Return
4 `. y- Q! h8 {- W; U; ?
n% a {& m+ l, \5 A4 d' a0 - No error0 j1 l: z) r4 V0 t% A
Otherwise - Error Code7 u, H0 \8 V2 p& ]/ W6 [" g0 a
; D3 t8 W2 c& }6 c7 l5 ~8 ~3 ]. t) {5 b
Environment
1 v2 j# j: f1 {+ B! f$ ]8 W) C1 f1 i8 N: |' f8 V% c+ X
Internal and External! V7 H! E/ b% C8 L: _7 q
$ y$ D G e9 g
( k# W9 i+ g% b- c1 W4 l Y8 i$ d
History
8 f9 G9 ~+ u1 H) [! P9 C5 y3 V
& W$ ? h& I9 f; l. c8 t j7 oOriginally released in V16.03 |, T& R* D! R, Z9 G. m
- O4 C, e* j3 b) F; p8 ]% R' ^- F* D# U4 s1 o
Required License(s)+ R$ c6 d6 v/ R- Z
; G8 N, w# R* w7 m9 W0 {3 P$ g
gateway
1 Y* z% e( s$ Q5 ?
" _ J* @* C# l4 p
* p. X7 X0 o5 n6 l; K! i # [9 A( c3 A- g3 b, H7 i9 N9 j
int UF_CFI_ask_file_exist
- D- y6 j; ~' z$ P+ e(, X8 A4 t% a8 M
const char * file_spec,, l/ z8 U# s: H$ v" y
int * status' r6 H8 a" U, a. D6 o+ o
; q; x4 A& _0 ^) G! e1 o6 L4 Q* ?; p)* y8 _+ A1 g7 z4 N( n
: Z, h" O0 ?- }" Fconst char * | file_spec | Input | The file to check | int * | status | Output | File existence status./ ?- y6 l1 D8 j* h( I/ a8 J
0 - file exists
* ^7 ]& A5 L5 E: y( H1 - file does not exist/ t ]/ F# n+ F" P% g. A7 P
! O) D l8 J2 j& g/ q | 3 r) ~% p d, q* R
|
|