|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
7 C9 p9 @7 u3 G% Y" u( }# Q
& X$ E" C1 {7 w在进行相关文件和文件路径判断时候,ufun提供了内置的方法。
& i+ j- g9 p: sUC4560 通过设置第二个 参数为 100 可以判断文件夹,通过设置 为 0 可以查找文件。, l1 X9 W. v) m5 G9 q: i- c2 l
( `( V& Q5 x- E+ S, k9 X" d; N9 T% U, A; t+ B; n0 \( F n
) n1 M8 f) B7 C/ i8 c8 K+ F8 M
( `* V5 Y9 V/ B ?4 buc4560 (view source)& D0 f" Q! ?9 b& s
, B- F' P& f; S0 s: J% j- T# L d3 j
Defined in: uf_cfi.h2 A3 C: u! W5 g2 h
7 J* n* k* O* O. Q! P1 {- G
9 s. S' J/ G. Q3 v* gOverview% y0 G0 G( {2 U) Z& Z3 L9 ^ l2 {4 `
' Z% H9 Q4 S+ |9 b4 `0 O
Checks whether the specified file of the given type exists.
( ~& s3 H) O9 j( s2 q5 t& t4 n- S# h
NOTE: Mixed or upper case file names may not be found if the6 b: _- m8 v8 V/ B: g& d" E
environment variable UGII_OPTION = LOWER is set.
# W* n Z. Y, U( Y2 L8 v2 n e" l B# s
Passing an ftype of 0 will look for a file but does not work for a directory./ ^% }4 c0 o8 E {, x- X" Z
To check for a directory the ftype must be set to 100.
5 B; Q6 K0 {; l( g0 g$ X# L& R4 Y- h: n
7 U9 F2 @! ~2 W( v3 E
Return
$ H0 C1 X) P7 B9 v1 }
3 m- r2 B {6 c2 s9 t' `0 d* w: l2 b/ MReturn code:) q. Q3 N( F6 n$ H) f) T9 V {
< 0 = Error
N `2 A' B1 P- P= 0 = File Exists
% t0 ]" d( `. G* p9 E+ n# H= 1 = File Does Not Exist
* F: ?: E# X8 P9 t
) _# z) Q. E3 \- k/ u9 @4 Q) I1 a, H7 P+ I. S: N) V5 q
Environment
9 ]7 M5 |9 \7 h7 b5 G! y+ X9 u: W, Z7 t& X
Internal and External( c# r$ J: ]) O& D
- E( g1 F8 Z. p4 A4 M( y! R: X6 ]5 b! B% u
See Also2 c2 u3 f/ _* @
" ~7 h; u9 Q* s4 wFor description of file types see table" q V; v& x" X2 W8 N2 [4 f
& i; `! y: ~/ I4 [# p
) r, Q7 G2 L4 Q2 f2 [- M8 DRequired License(s)1 k5 t. [, A% U7 v' g
4 h; F) w: A$ N4 ]) a1 P5 o" cgateway' I K7 A: a8 d& x4 s7 X2 H, B1 e
# ~/ V0 g. L! j2 h. V: r) M, n1 |$ j
" j1 W- v& G% T V5 f' P ]
int uc4560
: W3 v2 [* Z8 O) L& ?5 l(+ f+ T1 G8 _8 H C5 B' S
const char * fspec,
7 N) O7 e: W" C! m( ]+ M6 ]int ftype8 G2 a( y0 g4 b/ M, j
+ N+ Z" r& ~. z$ |% d)8 m6 f; s+ I) a
- e* u: w6 R0 N; B* l$ u# Mconst char * | fspec | Input | File to check | int | ftype | Input | File type1 \, Z3 ?* u! N: y* w/ P
0 will check for files8 d* u/ `$ K6 y! G/ @1 i
100 will check for directories |
. K4 n# h5 ^: \$ g( ?& I5 L- S
. S4 t p) }: u- F- Q% `9 u& |6 @
查找文件也可以通过UF_CFI_ask_file_exist
! c- W! v+ t9 n' \8 |& _- M2 N
, B7 ]8 q( ~/ K2 O$ G1 q% IUF_CFI_ask_file_exist (view source)
+ x0 ^. F! C! X% c: K 8 {4 ?# n2 |# _& z% t8 F. U+ |
Defined in: uf_cfi.h" e# r- D) \- U2 e. A
/ Z. [) x; a" ?" i% J, f% _7 w5 E
; O7 S" G# b9 v' C a4 j) P# nOverview0 s2 l; S+ v) O- @( e
2 u# j$ d! N! l0 W( |Test if a file exists.7 y" l/ X/ N) e( x+ N% M( s3 u
% H! C3 ]9 D4 q2 J9 h x4 x6 h2 ^3 V: k
Note: This function only works with files - not directories. To check if a8 H5 X9 f) f" |8 M
directory exists use uc4560 and pass a file type of 100.8 q/ a7 P4 _; P& J! o6 k$ x
9 Y1 @% p' ^; _/ N- I4 b' c8 V
. b, B) m& _: Z1 w% u
Return
. G7 c. F, U8 d2 L
, s. ^( S0 V. k! [& |& p0 m0 - No error
5 {6 m9 V& m- L1 m4 \$ t# i! j' UOtherwise - Error Code& K* q( ~0 X$ p' d5 D- q
- k- _* W" h3 e) M. y1 Z; e- l
5 B$ J r1 P9 dEnvironment
0 j- T( R+ E6 m: F
5 ?& d+ J; R6 u; S: I- }1 _Internal and External' X( x' o3 A2 N6 u' Z
) M2 k% n% k! O4 m4 V6 } P u' Z. S2 l" x
History: G8 C6 \, s n w ?* M
- X$ T4 S; ?. X* o% z3 ^& XOriginally released in V16.0) n1 m# @+ O R8 M* w. }
) H1 r9 e, X8 W$ y& t( d6 o B* g3 [# J( S! r
Required License(s)% O' p- p$ S7 G/ d. j, ?" M2 e( l% {
* C. `, |$ S( W+ Y- [3 u
gateway
! E2 |0 W4 }" e$ r# C" `
6 u- M5 p0 h! L
6 W* B, ^! I) }! J i
, C/ K' @+ B3 I6 u; yint UF_CFI_ask_file_exist& U0 Q5 ^4 u+ T8 o
(
- }- s1 @0 I5 O% x Vconst char * file_spec,! a9 q% e3 e, n1 A5 t7 m, X( _& _
int * status
3 b7 i4 f* z/ |8 M+ C
; b9 g" G Z8 \0 {% @5 x3 D)
: G5 D3 P+ n& z5 K* R* }2 G( A `4 W& ^2 \6 J" q
const char * | file_spec | Input | The file to check | int * | status | Output | File existence status." p l$ x; n7 l8 U- \. C" Z4 r$ t& E
0 - file exists, q- }. i2 ^7 H3 M3 v& D
1 - file does not exist
8 `& [9 P7 X9 E' {, V% F$ b: b1 y
| ) P# N4 Y/ j' U) p* Y+ G- B6 v6 M
|
|