|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
) r, g; Z& H9 e) Y* E l5 G" F9 K, e8 s# B
在进行相关文件和文件路径判断时候,ufun提供了内置的方法。8 E+ K- T0 S/ o
UC4560 通过设置第二个 参数为 100 可以判断文件夹,通过设置 为 0 可以查找文件。7 f! Z- M2 _$ O! h* W
+ K1 z0 a) e! W* H7 x. Q9 q
0 Y! Y4 X3 C8 r4 \1 `2 @& x
6 f2 ?" U7 u! s: x! j1 a& K& y6 ~4 j/ P/ @. f8 r
uc4560 (view source)
; R* k p/ e9 z1 j0 h" g2 V: _& F
3 T$ g" g T% I; ^5 S FDefined in: uf_cfi.h% O) [" Z; Y* I; M7 k
& \) Q# D* K4 e! \' q x$ l4 k- o
# S# n. d# G" `8 H! l; f* t4 U6 b
Overview
+ s. P! t- h; d7 g0 V5 i2 {
0 T0 f6 {6 {3 w! H) wChecks whether the specified file of the given type exists.5 R) N6 q' t6 e& Z1 t, g) O; R
1 y0 |) b3 K. x6 P) L1 p4 N" ZNOTE: Mixed or upper case file names may not be found if the( A- x! b; y+ y# r9 s
environment variable UGII_OPTION = LOWER is set.
* O, [ J- j V" B+ s
3 ~ @! B( H1 |4 lPassing an ftype of 0 will look for a file but does not work for a directory.4 t) ^* _) a" k: V9 k) `, \
To check for a directory the ftype must be set to 100.- ?% v$ u) I; x! m# g
, j, @7 d5 v. g# z7 @% Y, r; l2 J' ^. Y+ q
Return
X2 V" t; W4 X0 W1 N2 B8 `6 w+ J2 _9 m- L! _9 `9 c
Return code:1 D* w% p' r. G1 t f
< 0 = Error) x0 u- Q& @, a1 Y# s% l" Q G
= 0 = File Exists7 W! Z+ I8 i: ~3 I5 X( _
= 1 = File Does Not Exist1 l3 f' {) T2 M9 n: r1 j* j
$ U9 Q' U, z+ s& y2 `1 w. p0 c, M2 J3 E; {0 q" A
Environment2 ^/ ^+ p1 V3 d1 j, s
% t( w2 O; p) M. b8 m$ ^& W# F/ c1 _Internal and External
* E7 b. O' U4 f6 W% o0 M
5 D/ q' m, F2 k3 H- ], T5 `2 i7 K% {+ G$ ~' Y8 \" H
See Also7 ?. ]4 o- P4 ?' J! Y
8 f% p9 O6 U$ R
For description of file types see table
+ A. I, Y& H, o& E2 y 6 Q8 t3 o0 p u3 ^
/ K6 |& d# k/ z9 u) S$ lRequired License(s)$ V$ P$ T& L, q+ S. N
! r+ n8 Y% Q' Q Igateway
+ ?1 e4 B, D N- R: s# [4 H9 D5 f0 R b: l& k, `
% E/ N/ G! C% d2 g( G- A7 f* X" z5 d& g
7 D( {: J0 @* l. Y7 ~! \# V
int uc4560 p6 L# B) w0 O- q$ M
(
- T! ~4 ]! y9 H6 q1 ^4 dconst char * fspec,9 }: N* L3 O: X
int ftype+ ~9 D6 `$ M2 D. K
& z5 H$ @. @ @* Y1 J7 p- J$ D
). W1 v* v8 m+ E3 k7 ?7 I
V4 H4 Q. q) s: }0 Yconst char * | fspec | Input | File to check | int | ftype | Input | File type, Z' M7 o; d. E" D
0 will check for files: W, V; W7 P2 |. g+ f
100 will check for directories | $ L: C F; {( Y- ?" f z
% @" d8 |9 s: p8 ^: B2 V' U' S e
! _6 n: _4 G; a7 E j4 |
查找文件也可以通过UF_CFI_ask_file_exist
s, i7 p0 @' P, L0 n0 S/ t3 @0 [* v5 I/ Q% W% @
UF_CFI_ask_file_exist (view source)
& f6 D5 ?3 b# s ]
' }- u2 \* u. V+ I) tDefined in: uf_cfi.h
7 a/ S: n, {( f / v6 e2 J6 {; Z7 e3 a
% _7 b& I8 u% y# V# b" |8 C
Overview% B' Q- b9 z+ c7 t$ _' I
; A& a4 w2 B: a# JTest if a file exists.( S. M1 u- w$ n- ^
6 V9 A! y8 W! r- U \
Note: This function only works with files - not directories. To check if a; v7 k+ N0 X# t8 M: x% U/ I4 E1 g
directory exists use uc4560 and pass a file type of 100.
8 _2 U" a: V) V( n4 Y% Y7 Y: a! b' @) k/ _. b
8 N, d2 ?% \' M! WReturn
% v) R- F4 c8 A4 l. k; v5 z! s6 v0 l+ V0 V- x [) g! ~5 K
0 - No error* _2 N2 G3 k w. [
Otherwise - Error Code$ ]6 ]% b3 d2 g. l
3 C- z! K4 f+ k
6 o2 s: a. O* S9 x! n1 d! |Environment. T3 o: H& ~# L1 p
3 I ~# V2 s% b Y: M7 P) OInternal and External( |% o! `8 G3 E+ j+ Q3 o' Z. R
+ d0 ]! k8 p) G$ l# N. W& C
# F* U' M- y; V2 i6 C
History3 z# J# D% i% P4 q
) s, G( u: e w% E3 A- o' v8 }
Originally released in V16.0
2 S' g+ K& O8 i3 Z/ h/ ]/ `9 x: q
1 J$ d" V2 p P1 l# @& y
' j7 y. w+ B+ SRequired License(s)
+ P P4 \0 I6 r, O2 o( i5 I, G* L, O3 x( m
gateway
# Y8 x; ^* ~9 A+ t6 L2 l" i: k
y( A- \, h9 `: t; {/ t4 b0 n+ a/ L1 c! M2 e9 v& a
7 x7 T8 S0 i# d. Vint UF_CFI_ask_file_exist/ C" R9 r+ l3 `: z
(
$ n0 a4 {- t! c$ I( H+ Rconst char * file_spec,
: l( H/ i1 h, Q8 Hint * status1 E$ f/ L% c* `6 @3 K7 W
% q" d7 ]; _ B a
)
+ W+ h: ]9 i4 ^- `9 c, ?7 |& r" I2 V! i% n, R6 T
const char * | file_spec | Input | The file to check | int * | status | Output | File existence status.: m$ n2 \: v( L3 O
0 - file exists
% Q9 R+ J. U5 t& b \2 ?' {1 - file does not exist
8 E8 L% |/ ~2 A
; [, R% j6 }! q( ?- _$ ^4 S3 W |
0 z; {: \' s: ~ |
|