|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
1 q) d) c% x$ x
+ ?1 a7 e0 D- F在进行相关文件和文件路径判断时候,ufun提供了内置的方法。
. B( s: A$ d0 L: {( YUC4560 通过设置第二个 参数为 100 可以判断文件夹,通过设置 为 0 可以查找文件。, |% T; [, F9 ]. A# F2 @( t
: A* `. @; H' y A) j, o
, p8 F; p$ a: H
5 X G e" W& u: Y) ~9 K
- u. Q9 {6 k7 P( k' N+ {uc4560 (view source)
+ G. T* U* ^6 Z8 G z: S3 f+ G 0 ]% E! g8 H, K% J) w. O1 \
Defined in: uf_cfi.h
C2 I ?7 q. Q; P% I$ ? 4 Q* J' w5 q7 f# Q( a/ N4 u
7 E3 Y1 N) e6 p( x3 m8 COverview, r" e" a) I' S% M
! _6 J2 `+ g) R8 G' t( ^Checks whether the specified file of the given type exists.+ C3 m+ J# {* h- g9 K
; A3 I, H/ O- G$ }/ \, \NOTE: Mixed or upper case file names may not be found if the9 c4 I8 d5 ?5 @. [, M+ \
environment variable UGII_OPTION = LOWER is set.; y' U0 H8 [( X& P& k- o9 U
# u4 a7 {" p* {1 F
Passing an ftype of 0 will look for a file but does not work for a directory.
5 ?4 t- D. l9 T2 C* hTo check for a directory the ftype must be set to 100.
) L8 o% N/ {# p& e+ X
: L' x2 u& X- ?; _
- ~1 z3 c+ I- Z0 W. {6 W9 V7 dReturn
0 Q3 Q2 {: X5 }7 ~2 M- X$ |
5 h* v+ p4 K7 i7 f( IReturn code:
1 L2 t5 t# ]# @8 e2 E< 0 = Error
U0 q& b- @" y5 _! e= 0 = File Exists
" c- w6 ^0 ]: [/ D) M= 1 = File Does Not Exist6 R4 `: j/ X* F; l
; v. y$ N# a5 V/ X9 v: w! E
) v3 c2 u, x$ w: X9 {! }* |8 A
Environment6 V& J @. ?8 U" S
: B3 F& a" M8 Y" CInternal and External
5 n8 Q* {" [- ]4 y( c, P. T4 c3 ~ H5 z2 J
* v0 @9 F) ?& E% X
See Also3 | V# h+ X" I8 X! R) D+ t. R& b' S9 h' |
* j8 V' G8 C1 }+ V5 `- }9 MFor description of file types see table
9 c1 G V. v: @8 |+ S ; J8 C+ m, }+ ~! E
# }( L/ |( @1 j. V
Required License(s). N! N1 L# t) z
' g" }& @9 T7 }" a; W$ J3 ygateway( x3 F, O+ Q, C( R5 [, F; Q0 T
y( `8 C, D6 O7 S2 I
8 p- g, o, w* p1 \) c/ l, q 4 ~- O0 g* z& v4 `3 [3 b7 N
int uc4560
?- x9 U9 R6 D; N, c1 J(
# P. M% ]5 v9 r! B+ i Oconst char * fspec,+ `/ r6 n5 ]) E/ E, \
int ftype- F' _' V, r# e9 R4 C7 M3 r
7 p, Q& C/ ^0 t9 B)6 |$ l9 M$ t4 r& G
/ M7 D' G# ^- W+ T
const char * | fspec | Input | File to check | int | ftype | Input | File type
, p5 o$ D2 E9 ?4 b. E, l- _/ O# a0 will check for files
+ }( b. r5 g$ F: E, v8 C100 will check for directories |
/ R/ [9 a! n- r! Q# P& `0 n
& ^! D4 r! `, ]' H6 f0 Z5 x( M( r: h2 O( Y( p* a# @
查找文件也可以通过UF_CFI_ask_file_exist3 }3 w% o, m& y
" M3 b- O: N8 }7 h( F
UF_CFI_ask_file_exist (view source)
# S* X w0 C/ W- H" X4 ^" k
; t; J5 ?# a* @. C5 V2 j2 w$ a0 tDefined in: uf_cfi.h
9 ~* t* T2 n& I$ N. q' l/ n, X4 t% G
! o: }9 m! o5 O7 a) F0 x+ T9 v ^7 A9 x1 _4 S) }; y
Overview- v: O* O1 F: u% f
& H) q+ Q6 e, ^Test if a file exists.
: f7 Y0 p @* \9 h: N5 N
+ e4 f7 h1 ?! ~0 m$ O' \; fNote: This function only works with files - not directories. To check if a
8 `. j. K( c- P) u$ R6 `directory exists use uc4560 and pass a file type of 100.
. R. \# Z: n8 ~' q2 j4 [, C* d& h2 {1 S, k
2 q! Y, y- x: aReturn
) e4 U% t' E! y% |6 M
( X; r }( p3 R2 k# z) A0 - No error
2 H; L, y$ C7 _* H6 P% v% pOtherwise - Error Code
$ Y9 z* f% R* t/ M B. |- P2 R' Y0 f, c
5 ?5 m) L5 N5 x! cEnvironment
1 b% n! h2 }5 V+ M" M
! H; g+ S6 A4 z4 Z2 ?! `Internal and External
) V9 x/ P& ]2 J, C" r0 v' h# ~ k6 q5 L1 V8 F h+ K- p
, [* d. l# t+ p8 E4 o4 PHistory! @$ g! f0 }3 b
2 ~" s; b8 z& j4 ~3 n
Originally released in V16.0# p: D' R6 j9 W& q7 G- ^# h
j4 s" U3 y+ ~% G
1 T( M" u& \; `( f! w+ J
Required License(s); L0 h, F) i( @- R% X% ~! ?) W
6 n1 g# w6 N8 \' f7 V. k& O- ygateway3 A( v! W6 B$ a: K/ k3 _' n
' l" i0 ?/ @2 o/ I% u; f
/ L8 ~9 B3 \* N) O7 `; Z
# F* \$ V, q9 E, [9 E8 T
int UF_CFI_ask_file_exist! T. [0 v! b1 G( a
(
7 L" z! l8 j. Econst char * file_spec,
& Q* a3 A" O8 m: @$ [int * status6 Z% l1 B @2 B) u: F! Z# j
5 V3 g9 M1 r2 [# y
)9 L: p' L1 V- m) W. ?8 t' w% J5 _
" w5 W; N. y+ ^, H' Aconst char * | file_spec | Input | The file to check | int * | status | Output | File existence status.2 V7 l% z) k+ K: @3 L
0 - file exists
; l7 S: L: G* n0 l* ] v- ?+ ~) D1 - file does not exist
! T8 {! d! [! `& E2 `
# N5 p% R8 } f i# u# U* L9 f+ j | J8 U7 U# R* c) l
|
|