|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
8 y0 ?$ T- p) |5 T3 {- E, z. b
( ?1 T3 R% x! C2 f5 X. @ A
在进行相关文件和文件路径判断时候,ufun提供了内置的方法。
& m& B' ^) ^# {- \UC4560 通过设置第二个 参数为 100 可以判断文件夹,通过设置 为 0 可以查找文件。4 H$ V2 r6 k" U( R4 \+ B9 f
1 V, q9 ?( n' K& ^# N4 G; Q1 ]: |, Y9 N+ g' O9 u) y
. u k. J! ~# Q- W( ]/ a$ |) q, {8 V' D2 E
9 f' h8 O2 e# y' {uc4560 (view source)
& _6 W$ A( i" H4 _) L9 P $ K1 J& B$ n1 ?9 B2 ?- \
Defined in: uf_cfi.h% _3 h% t8 ?6 E1 g
3 @/ h( Y; w" f. O) o: i; H
6 u, e5 t X9 ~5 @! ?: Z& n3 jOverview$ m; X3 r% Y4 `3 f6 U* A* ~0 N6 b
2 _$ J- p- g+ `" Q9 |* y
Checks whether the specified file of the given type exists.6 u) G2 u1 W- @ o# K8 g( n% d5 \8 _; k
- I% ?: w) y" h, h, y" WNOTE: Mixed or upper case file names may not be found if the
6 s# S- U; Q' S* M; M4 }/ P s4 zenvironment variable UGII_OPTION = LOWER is set.) f8 J2 e- I" }. N1 z+ q" B$ b
$ K; s! S; z" l! v0 [Passing an ftype of 0 will look for a file but does not work for a directory.
5 b3 Y+ S+ a* H1 ~7 C( XTo check for a directory the ftype must be set to 100.+ D6 E( O/ |1 l! ~9 Z& S: V
; o* n& t& x4 H$ ]* W& `
- r V8 ]/ C& o" |$ e" M- |% tReturn2 X4 ~# Q; _3 X' y
- s5 |5 @+ c0 n1 L) [3 d) PReturn code:( p( L$ F$ r( _1 f
< 0 = Error
0 G% n- O/ X/ L1 [, I% i= 0 = File Exists( h9 ^7 X' M1 D
= 1 = File Does Not Exist) ~9 ?$ U2 t+ C
$ {4 F |- T, b0 l* I1 U4 u: s
Q" X2 p5 K7 |: Y/ qEnvironment0 p" R) ^; C! m! w. n. ]
8 k' I" o* Q9 B; J, xInternal and External8 N7 Q9 A# y4 J: K8 Z
! Q) C% E3 r4 Q9 |2 O; l3 Q: g3 D6 U8 d# r
See Also
4 u; P, F" H* c/ L* B
0 Q* _) i0 C( G# p/ f( ?For description of file types see table
. H5 ?* T0 P7 x) n6 w ! f* B/ @4 O' Q* L$ P* o) K1 c
& x. l, w5 X2 x8 x
Required License(s)
% r8 i3 E( |7 u* B
! N9 p6 p. z- Qgateway
- m x% P* _; S: X3 G. |8 b2 J( Q5 U: J" v6 r. h
" w7 K9 s" C1 X$ f, P$ d" h. |
: Y! E) N$ z$ _* m/ }6 j' v# kint uc4560
5 S8 K$ M$ j7 F% X7 w(
0 H) {5 r$ D: N4 Gconst char * fspec,
- V5 c$ ?" o2 h/ F H4 T% d: W: j$ aint ftype7 ]- {9 A5 t1 J, H: u
$ I/ d/ @) R" t
)6 _" `4 S2 F6 `6 w5 \
# N- `& S7 N; a# ?# G; N- Bconst char * | fspec | Input | File to check | int | ftype | Input | File type
/ R4 ^, `$ K% }4 y1 p0 will check for files+ v& s" z4 {, K( Q
100 will check for directories |
4 ?& o) r3 ]- p% B% }% h. g
# @& s" M* y1 b/ L) x7 {) e9 Y% K' C" q9 r8 B* F, {
查找文件也可以通过UF_CFI_ask_file_exist
' H( _ @2 b. |: m3 H ~0 s0 O4 Z# l/ g. Y. m/ N
UF_CFI_ask_file_exist (view source)) e+ y' C1 w, b9 ~ ?4 z
6 l, d. Q( v4 a) ]* E( C) X: c
Defined in: uf_cfi.h- j, F* X; q0 o0 _- N' |
1 p1 `7 n1 _& w" p5 Z9 T2 w# s
5 D( c' B7 Z2 F m& I
Overview7 r" j t! f$ F/ h0 @
: c7 H, M" o2 h1 A9 NTest if a file exists.& @+ ?9 @+ n/ W, _, Q& |5 r
( S% Z) \8 t: q
Note: This function only works with files - not directories. To check if a; S8 ]$ [, S. d4 |% s- E) B
directory exists use uc4560 and pass a file type of 100.
- c- T# E5 i8 q& k$ E1 w+ p1 M1 {+ O8 m
4 @6 n9 O: r, Z
Return# ?' J/ \! t: V; a& t4 w& r
% u! e8 ^- x2 n9 W+ {. m9 y# {9 e7 B; u0 - No error: p, X; K7 d9 W+ l$ r# n: s* u. @- _
Otherwise - Error Code4 S1 [& o* n. v' O/ h7 G; [
" A) T( s( W( @
. N& {6 \5 o/ s( O* N+ G+ r" l! J$ REnvironment
& Y& a: i& P; d( c! ^ O
1 F z5 K7 c& r p7 MInternal and External
2 F% X1 Z5 w/ H3 p" a! e: a, P
* l+ G0 q# E- I9 H. w% O' q
. `* k7 x( X- a4 a7 d2 Q% f1 zHistory' E7 X6 ~8 F" C1 h8 T/ d$ U
. ~5 ^* A$ A2 V) r% nOriginally released in V16.00 X& K1 K, B' p# k) E0 i+ M8 f
. }% J. `5 E8 S* _; t' p1 A+ ?
8 }" d% W; M4 Y/ q3 E' |0 |
Required License(s): C" Y, q0 F# W. P/ m# a/ L
8 J7 G' S3 a0 {* Mgateway$ G0 e2 I; G) q5 N+ g
; \+ U- ?1 {/ U) B' N8 [% P
0 C; _* `) Y( n. l$ E4 g ! T7 C) j9 S8 A. ^" C6 k
int UF_CFI_ask_file_exist
; M+ @9 a6 }) h0 U( F2 V) M(0 B$ `8 v+ ]) e$ p) P
const char * file_spec,+ j# M5 ~" F* h2 `
int * status9 f1 n' w. ~" I% d
4 w9 O* R- ?7 c3 e2 f, z( X& H)
Q% \ ^8 P. h3 C7 K
! g& x5 I5 t6 ~" Tconst char * | file_spec | Input | The file to check | int * | status | Output | File existence status.
8 O; X1 G, b, i, L7 J5 ?5 o! U3 z0 - file exists! f3 H. A0 M0 a7 F' h$ p4 d* J& c7 e* O
1 - file does not exist4 G" P& y' d; W
. s8 O ?( y8 p/ Q5 Y |
7 ~: ^7 F) E9 k% k3 e4 o" c$ X |
|