|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
) D- C# l6 b7 w9 H, @% T7 V
# N) Y7 }0 B: b p s" V( m I在进行相关文件和文件路径判断时候,ufun提供了内置的方法。
3 ~. j/ b5 l! s0 |UC4560 通过设置第二个 参数为 100 可以判断文件夹,通过设置 为 0 可以查找文件。7 w/ o& |8 s/ W! j; n+ k# b
4 `* U9 P0 h# L+ l7 J, P; Z' n7 e, l
V. A3 U& ]3 y) ~, X% O" f O
d3 g$ G# p9 n% u4 x: `8 @
uc4560 (view source)
$ y5 M# } P! w! X; Z# [" B+ r 1 X% N3 S& T4 t4 l! u$ @
Defined in: uf_cfi.h
" }6 i! W" E: R4 B
% d2 V; A2 e6 _4 d7 q
& i9 k* G1 d8 z% y) KOverview7 R. O/ S9 b( ~7 [, z1 s
i$ E1 @! J, Q- q2 ~- n# D& A
Checks whether the specified file of the given type exists.1 f/ j# T" [( p3 z5 z- o/ h0 s8 B$ O
' J, d" _# h# n; a: ~NOTE: Mixed or upper case file names may not be found if the" p) o. `' \# I% X
environment variable UGII_OPTION = LOWER is set.( }0 _1 J: I, {7 X: b
$ H4 B6 O0 q% P/ c1 h8 z
Passing an ftype of 0 will look for a file but does not work for a directory.
/ t: m3 }( d0 u; ]' K; oTo check for a directory the ftype must be set to 100. F' }1 V0 p; B6 ~9 q; Y
$ ~: j5 W; s" T+ t$ p" @7 M# O1 D8 p& T3 D
Return
+ C/ K* A5 L4 l0 V4 T0 M* W/ y% s4 H$ i p; c+ \8 O
Return code:( o7 n& r& [+ i2 P4 G" I# l
< 0 = Error
2 \& X0 V2 R: i% t g" h6 w# d= 0 = File Exists
/ i& g* Y" \$ O+ V1 H1 B% H= 1 = File Does Not Exist
, k+ R, U$ Y* B, w) x: m) A
/ j, a+ L% [1 b4 i+ e* T3 x9 }- R( ~/ G- s4 O% y* t7 ]% @1 Z$ ]& f
Environment( N$ \2 i' N& g/ B' ?
% e4 W: t. e: E( G( g6 s& s9 fInternal and External
2 K- l, _5 P2 }( m$ M# ~
, M- K: w3 ]. N, I4 D H: e# M0 a+ k8 d+ Q- V% M$ C! R
See Also
# `4 H6 v- G3 Y0 u, B! C
8 _/ e/ D6 y# t. bFor description of file types see table
8 R0 F( o! w, N" D2 m( B
, h1 B, y. Q$ F" E4 C7 f. m* [, y; q7 Q- i. W2 @
Required License(s)- f; d, r4 e4 u& A& F
4 c, I# [% J0 j# J& G- X% ]. [
gateway4 Q8 Y- `5 }8 q" D- F7 A
- v+ Y( w# w3 o* h2 Z+ }, E ?
- m# E1 z. D9 E9 U7 o, @5 p " k$ i: R" q$ ^- m+ ]
int uc4560
9 d6 o. B' P3 O. U7 s( h" h2 b: `9 }( }
const char * fspec,
6 S5 s/ l8 l4 Y E6 @/ z$ z8 U7 qint ftype
; r4 b7 k! O b+ O% p! f$ ]: B% t+ J7 Q: o- T2 E
)
1 i) F0 } X7 C' T$ j1 b) w
% ?( Q L# `* e; W& Z| const char * | fspec | Input | File to check | | int | ftype | Input | File type
2 O8 e5 O/ v# V8 b8 X. d$ k% z0 will check for files7 g/ ?7 |" C% e/ q5 B4 k% B" j3 [' Y
100 will check for directories |
4 |' {% q/ r- D' \1 Y3 f% a
8 [4 g; ~( x7 x) ^$ Z+ d% j- i& `/ P3 V% G: G
查找文件也可以通过UF_CFI_ask_file_exist
2 U) i: w* B4 _. A$ m6 D4 e8 ]7 ?
, m+ O& V$ x+ {, \UF_CFI_ask_file_exist (view source)
* q- j7 r3 n5 Q% O, d7 M# `
8 l- g% F6 {. TDefined in: uf_cfi.h
3 O. l( E$ | p e) g/ ], u 4 b( c3 z( G# v2 T; A( P
2 `$ e) l B6 Q2 m" `5 dOverview
: X* b8 E* i" E* j% W
K5 S; ]+ K( O, w7 b6 R1 C8 eTest if a file exists.* f# M% h% U# [
" Z# \6 ? N3 Q2 B! g8 W) G
Note: This function only works with files - not directories. To check if a7 ~3 S6 d% W _, K/ m- V3 d
directory exists use uc4560 and pass a file type of 100.2 x1 h, N2 f3 o O; _, R7 }3 B. V
: o4 E a6 Q. k- q
: V8 A) j* Z; i5 b, oReturn
, T% r0 m9 e; K- H9 q* O2 e+ r- u) x2 q
0 - No error
. y. G4 k$ u% k( G. V# |Otherwise - Error Code
+ \$ G: }' a: B/ ~( I: R$ Y7 K- q( j- z8 j! {* X" q2 X0 z
1 s+ p: O7 v3 t! YEnvironment+ J* @+ l' @1 Q
0 }9 w+ O1 l+ N0 I- I) N, n7 s
Internal and External
. F' {, i' [" u A9 p5 D
% U5 y' y- e! f6 Y4 z; c9 T3 e+ b3 s) a x0 B7 U8 n k; a6 {9 i
History' M8 V2 r( g/ ` E4 o" F K
% U* i) \; s* o1 _3 v- D
Originally released in V16.0
: b( a, ~) l$ m' f . U* e3 O# b: J) X
1 ?% j: X% C+ l2 r; DRequired License(s)
+ e/ t) A( F0 {/ j: ^
) A, I. M6 a! [6 o1 h0 hgateway
1 x |0 J+ V, L2 K. R; X
% l8 y+ Q" R$ O* m7 ^% B4 J, l, _6 H4 L
& y5 c- n, O4 e. K; g8 D! q
int UF_CFI_ask_file_exist
* {7 @; d; k. e; o(
( f5 ^( q3 X. @, Yconst char * file_spec,
: Q, n& o+ _- B, P: g& \+ z! T8 jint * status+ N+ E" B, ~: f0 @- j
) [+ X+ `) y8 b8 ]! f7 s- }): G d$ j5 X9 s3 `1 y
/ l; R4 e& r& Y$ v/ r% U2 B: N9 ?| const char * | file_spec | Input | The file to check | | int * | status | Output | File existence status.6 K: s4 ^$ x+ H8 Z! r
0 - file exists7 e4 s% V' @5 C6 R/ K
1 - file does not exist1 d4 E8 T5 j' K3 T
; u# x( w( H/ Y! L6 q |
5 Z; s8 ~5 D+ k2 M |! n |
|