|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
8 m3 b+ _) }0 b9 q6 N. E
) c* ?1 {7 K' \+ f* ?
在进行相关文件和文件路径判断时候,ufun提供了内置的方法。" O' K2 g, H Y, q
UC4560 通过设置第二个 参数为 100 可以判断文件夹,通过设置 为 0 可以查找文件。1 J! Q' z2 N% j( V( |6 V5 O
2 n8 x- q- E& k/ g7 T0 ]" ?
# m. M. S3 M p( z2 {2 }
* s w& k% A' a* Z5 G# ]
2 c# X3 y& c" A0 Fuc4560 (view source)
3 Y/ ^0 G; q3 u W 1 h# x; Q8 y: J$ A
Defined in: uf_cfi.h2 h4 H5 X4 f4 a/ d8 \& [
8 K2 I; _/ P* l6 i A
, n n2 D# P. ~% o! X3 iOverview) `' x1 h0 J8 f# J7 m
& S3 W2 S2 K5 Q) m* w: z. KChecks whether the specified file of the given type exists.8 ?9 G& S/ U z1 r
. n' L+ u+ J2 R2 ]2 T4 P8 h3 }NOTE: Mixed or upper case file names may not be found if the# ^- ^# t8 g0 W7 g# s: d+ z
environment variable UGII_OPTION = LOWER is set.
4 A7 q9 u+ Z; A t' P8 e& j8 L% W/ `0 {$ I! L
Passing an ftype of 0 will look for a file but does not work for a directory. g; C% o# b0 C7 T: r3 H
To check for a directory the ftype must be set to 100.
5 [2 H' m& r( Z0 m, t( u" H; l7 }+ P! T4 y5 [. |* P( X9 y) n- X$ o
* q) ]" b$ C! K+ n9 B ~Return j; B" q* X1 |
2 z* P T9 P) W" Z" `/ Q
Return code:4 w1 c9 E' V }- |
< 0 = Error
& L, h7 F! @2 s7 r. c2 ~/ O# o= 0 = File Exists
, \0 ^+ L7 z0 D= 1 = File Does Not Exist
& V: ?" f L2 }5 W2 E! n5 ~1 y- l! m9 B2 _
- Y! M5 y/ C2 p7 \ p2 K9 o0 }Environment
3 ]( ]+ x- y) w$ g: q. p2 _: k# z2 i, F1 T/ w1 I, j: C
Internal and External, i3 k. F7 T+ x4 R: w) V3 t8 P8 h
7 ]2 y; c4 o* B2 S
$ s9 ~3 A+ O# v5 a# uSee Also8 j. e, j" H+ F4 \- C: x- w
4 G1 }# K4 q7 h, ^For description of file types see table" T; ]4 C5 z1 k3 T$ r w
7 q6 ?) M% m J6 C# S
9 R4 L& E7 m9 mRequired License(s)
( A$ ?& r1 Q1 i) O% C- {* }+ U2 x7 ^7 o3 X) {% ]" f, _, o# b
gateway/ f9 G/ ~( a5 k7 ?/ M5 Y
' K: h( m( K$ |& c8 n" ~' S3 o2 J. w% f( U+ S; K& }
) `6 Z. E$ h/ Z7 T q
int uc4560
( {& P" L! _0 W# R(
- J2 T9 n9 x, S, W6 V' B: H j0 cconst char * fspec,
1 j4 F$ A( Y) Gint ftype
/ b1 T2 Y$ C- s0 e# O/ |3 _; a2 k) T) _! z5 s" {
)
( [% \ ~, a( a9 i9 }$ K$ ?! S9 J" E5 K7 ~& Z! ]9 W: X8 i
| const char * | fspec | Input | File to check | | int | ftype | Input | File type/ M! Y- a) X( t5 S4 [* U, l- K
0 will check for files) q; l9 {& s* W, ]5 Z
100 will check for directories | . [1 X# G4 V' w3 V) l" ^' Q5 G, p# I
. I8 r) W; {7 @* c+ D
8 }( Z) E* z. q' |$ s5 P
查找文件也可以通过UF_CFI_ask_file_exist
7 m% `' ~- P0 S! b( a$ U0 F `/ ]; }& l
UF_CFI_ask_file_exist (view source)
+ M4 T# V* B3 T1 r - A% ^6 [& m% t
Defined in: uf_cfi.h
$ W% p8 u. d( ?5 i4 M" D , ^; n3 U! D, S1 C/ J+ k8 J& \* T9 d' ]
# z1 d% F$ o7 n) a. b' W, sOverview+ y$ u0 @' k3 F4 u9 u% B9 P1 u
; q$ ?: i# f) n; l! b, K
Test if a file exists.
+ [4 j$ V! k8 r4 w1 J# R4 @9 v/ g1 `( [3 d
Note: This function only works with files - not directories. To check if a- ]# [) G. ^" T' e
directory exists use uc4560 and pass a file type of 100., J0 }, E9 Z6 h6 O
3 U5 @3 _* J% e6 I
E& h1 E- j* s& y) c: q- X2 E9 O
Return
2 r$ c5 d- N. a9 I: T0 p. t9 v7 U" \9 ^( m3 o- e; l
0 - No error* _4 y; l1 T7 N. K; E @5 L
Otherwise - Error Code! V# `: W2 Z. y2 O7 j* q
U( f& U( z* N9 R3 [
6 ^8 v# y* ]3 {( s2 l! T- K( x
Environment
- |5 D8 v; u! L
/ \. T+ O/ o3 ~( |7 eInternal and External
# T0 g* @5 j. y1 O2 v, I) r5 q+ W; I
7 U& h: T" @/ L5 v' p- S8 ^5 x* e( A6 I: e2 y$ X/ _
History
' r e% N( a' _$ j: ~9 D
; R) K" n$ A7 R5 }8 pOriginally released in V16.0
9 u( O" q |/ G7 }
( L+ `+ G$ w O" t4 I. V- G
6 g7 W/ u; d9 C2 \9 GRequired License(s)
; U3 h/ T% P/ f& ^% O8 e1 @% L3 u. B. Z
gateway
3 A1 O% }" d* h, ]' z
4 O( T$ u7 H8 J! _* V% P# y& ?4 M$ Z4 A% K
3 J, |+ a+ e V) bint UF_CFI_ask_file_exist! G4 N+ b& S& L b* s! C8 ^* O: r
(
( v' b7 F, v; d+ b8 R. E/ oconst char * file_spec,) W* f3 h( x# }% q4 _
int * status; I: {# |) S* B4 W# f* R
; w4 |$ J0 U) g2 u: V* C)( O5 O7 M2 X6 I7 g" K7 k
; S4 O5 p) W$ @+ v& x, o- I8 W| const char * | file_spec | Input | The file to check | | int * | status | Output | File existence status." I+ h* Q1 F" t+ y- @
0 - file exists
3 ~8 h# J/ ?9 f1 - file does not exist/ z; Z- f ^0 N8 Q4 n) F" t
! O, e6 M$ d6 G0 c( B
|
8 k" Y( P4 y1 E# ~0 A8 s |
|