|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
8 C" @3 f9 ]( |2 z' E9 L7 V/ ]' _, `, ?, \! c# e0 Q
在进行相关文件和文件路径判断时候,ufun提供了内置的方法。: c+ T! a, g1 L( c' Y; Z, a( F
UC4560 通过设置第二个 参数为 100 可以判断文件夹,通过设置 为 0 可以查找文件。3 l3 d# m0 P# g6 i
) a: B! [$ i4 l) Y0 {" X, a
, Q9 n2 u! @% I8 T& u
& m, M* A) E" f$ j) Y- I' Z( n3 c7 A: \, U# s3 C1 [+ F6 l& n
uc4560 (view source)7 B4 v4 F4 ?7 `* z" I
, `& U, P) o. E9 v j
Defined in: uf_cfi.h: m: `1 U) r8 x# m0 C
0 ?5 Q/ D3 r' G' `5 _
: w2 V9 Q+ j2 g7 [$ [* `Overview, p& G4 E( C/ F, r5 J
+ X% @# C9 k) `. D1 ~( n- MChecks whether the specified file of the given type exists.
X6 W7 J8 p+ U3 S
: k: O- V3 I5 R/ x3 U v# V8 fNOTE: Mixed or upper case file names may not be found if the
$ L- H1 {2 D4 {environment variable UGII_OPTION = LOWER is set./ M* |# ?4 s ~
: s3 h ]6 e6 f2 z8 m! |Passing an ftype of 0 will look for a file but does not work for a directory.- r5 W8 D7 G% X+ a- k* E
To check for a directory the ftype must be set to 100.
! X4 b5 |8 v3 \4 p# ~5 U f" N' {9 d1 S' R/ Y* p
o! ~5 o* q( j! l5 p* }6 V
Return
% J3 J5 ^; q4 [+ l$ H U
! H9 C K( Y2 C8 B; T2 t& HReturn code:" x5 E$ t1 S% |- ~4 I: h$ s
< 0 = Error
& f$ Y; {4 T1 P. P7 i= 0 = File Exists
( v' B" X8 M5 t* U' |= 1 = File Does Not Exist* n7 F2 ?) {, @4 V$ x& \
: x, |, Z0 @8 P
b3 t7 s- c, ^" K s2 A+ {Environment
, q8 m' s) E( Y% m: w# s
7 O: f7 i) o. S4 ^. T2 [' LInternal and External- L5 X' B; [" M% o
% O: p" w' k2 f, R" [
: Q2 }3 R5 O9 i% @$ O
See Also
1 x$ k8 }6 z8 K5 C8 s$ t5 {5 K3 Y
: q' F' s+ A5 J- j9 X* |For description of file types see table+ }+ u: x! h( P w. }! J9 h7 c: R
6 \* i D! k! U' q, U0 T7 y- U5 n$ c' u6 N- d+ ^) S$ Y; n( m
Required License(s)$ J! D7 [! C4 z i( T! r" A
% D* E# y6 x/ T
gateway
1 B% X- h! B2 I/ z* _4 n, N
1 V# L; u& F6 X
. i7 L. Z @7 m s
) Q1 r9 J1 `; M# M6 |int uc4560
2 i( U! u' b0 G2 ?' q5 b$ c(
, \/ j6 a! @) @1 i. ~const char * fspec,
3 `2 m1 V+ G* \int ftype6 Z" N* g5 t/ X% w
% R# `7 ?- J. Y2 X. Y/ A); B* Y9 x6 X; @( i, ~' S
2 D4 _" y+ \, h, n! l) |const char * | fspec | Input | File to check | int | ftype | Input | File type
% g: B/ H H3 R' O: f/ r* z0 will check for files
8 r) ~$ Z- _0 b6 B) E% ?; `' m' V100 will check for directories | 4 w6 L5 X/ \# \" Z
# W( b+ n! R7 w8 y+ a, ]" b: X/ X4 l, e6 T% }; u
查找文件也可以通过UF_CFI_ask_file_exist& ]. d! B0 a' ^/ s* I. }6 H! x
8 m, u7 R1 I' R2 A5 H
UF_CFI_ask_file_exist (view source)
2 ]. c: W+ G: Q$ U2 o0 Q) l' v
& j+ S, H! w6 ADefined in: uf_cfi.h
- l6 T; Q6 v7 u2 s) _1 a3 v : o( A% }. F. C
9 U* U0 \% w" Z9 z4 I: OOverview
, ~+ B1 [& s, ~. `7 C. V! V) r) N8 _- q; L$ Z( H6 l2 U/ Q
Test if a file exists.( m2 O; A# J. C! q
# L2 B- W8 e; F1 lNote: This function only works with files - not directories. To check if a
' a* V' K" D, P# {2 Cdirectory exists use uc4560 and pass a file type of 100.
- `& B3 [8 d w7 f# R3 Q% y& Z/ j+ J; q4 J# s
& y1 c1 y7 ^ y7 D0 T1 Z
Return
3 G3 F- z% j6 g$ A, _1 ]' j2 R7 ?9 R4 S4 e" x1 f
0 - No error
! F) R$ w6 x4 J$ T+ Q1 V3 COtherwise - Error Code; x! l5 x# Z* v
9 q8 s+ W* h; G. a7 v
' f& l( E& n$ S* m( s% HEnvironment/ }; c! Y+ n* q x) U
. @' a G. Z# j% o
Internal and External" a6 y& [0 b6 T" |0 c8 O
3 E- j" {' F/ @" E# q+ B' c- q6 F: p# T
History
0 n. K4 V& P' z
- l" p/ Y7 q/ h9 h$ f+ sOriginally released in V16.0
- m1 O9 @' S# v; u, w4 }( A2 d
$ I# \* v% b. q# P, b( J4 E' T0 {7 o& q- n" k8 R$ F; L
Required License(s)- c8 ?4 ^+ P( \- O$ c& n3 m
/ s. N" @; [2 O7 T- i
gateway
. x+ E; U$ h: t6 z8 Y7 P, e
& l$ M4 I/ Y: E; t. `/ D7 s( N8 l4 o( U, q/ j) c
. u3 `* S. a5 |! S
int UF_CFI_ask_file_exist9 n/ p- R' h1 A1 v8 u* h% c0 b7 g
(
) ^. y+ F2 T* H! ?1 y7 ? jconst char * file_spec,2 V+ r- t+ w# @8 ^9 p& ?
int * status! O! v2 S8 ~' c
% l' G x" q/ ~; I6 D$ ~6 p3 M
)
% |- o$ n4 S, k1 c9 M. \- O: ?
! G( u9 u9 U0 w3 ^const char * | file_spec | Input | The file to check | int * | status | Output | File existence status.
, _% Y: l8 a1 }, y# e& v" K0 - file exists( Z8 u) q7 B- k t7 r
1 - file does not exist# ]( }' z( C; H
$ |4 W) w: m1 t9 J$ y; d |
5 c9 ?# `) V7 D! X- N2 t |
|