|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
- z( Z7 `* |1 D* }; _
) `+ k2 _ z: _在进行相关文件和文件路径判断时候,ufun提供了内置的方法。
3 h K( r) n. s8 uUC4560 通过设置第二个 参数为 100 可以判断文件夹,通过设置 为 0 可以查找文件。5 {7 i) M. J( _8 H
$ a9 F: K" x" r" l5 O4 ?% \2 Y4 c% g( }. u& Q- J/ i# l- l0 B
& l) q+ ~( X: s: d
0 [6 z! N9 z2 w( ?
uc4560 (view source)
4 f* I" t; @% |- }" W- N0 t7 R
& o; X) m4 Z% u: D4 n0 kDefined in: uf_cfi.h. y: v9 ^, g' F" g- R* z3 ?1 v" J
5 \ x3 j. h8 `: T8 i7 E5 A( O7 l. h+ z% @6 u6 |+ u
Overview
& q) p$ q2 B2 j0 w- B* B7 n' {7 L8 ]
Checks whether the specified file of the given type exists. D2 J6 f) d. U( R" T
/ R( ?/ n y1 N3 Q8 a, Y' V3 `
NOTE: Mixed or upper case file names may not be found if the! S- M! P; L( s7 G
environment variable UGII_OPTION = LOWER is set.
! @8 w8 i" `8 z- l
1 {1 g9 F6 t& v4 y6 kPassing an ftype of 0 will look for a file but does not work for a directory.
+ W6 W5 M6 D. J7 yTo check for a directory the ftype must be set to 100.
" c1 V" h y! U. t- k' b9 B5 ~# N# p8 r
3 }, F2 P2 u3 z" a% l( E. ZReturn1 |6 e! W1 }. @+ d$ t& [" {& \# V
1 }' l9 ^- g6 V/ A( `Return code:
# o0 _% P( |4 b; N& W< 0 = Error9 p! W9 ] `7 O% a5 m
= 0 = File Exists
/ B: a: p& @- z, R- @# V= 1 = File Does Not Exist: s: C5 }) X" c! o/ {( g
" o5 j, g& d( }. G/ Z8 T$ B/ V2 Z
$ t+ T' C3 x. p2 d3 K# d5 _Environment. X/ p4 A7 M8 c4 r. [
6 ?) |; y1 V! l6 q( H
Internal and External
! s1 w6 F5 s0 P9 l3 [0 p1 r2 h+ w9 A% @2 t* ^
/ O' z3 H2 [0 Q( T3 l0 Z
See Also- e8 D* p: B& b7 ~
) a( z( N' `9 L$ W) Q
For description of file types see table
- j$ Y$ @3 P; P: U! R( `4 ] 6 ?2 F0 E1 B! P0 j
3 B6 ~, P! Z+ L& d% U s
Required License(s)
8 V" M4 Y9 q$ R% ]3 X: E( N- a' _! i+ X t! p/ c( j, j" b3 _
gateway; t# g T: l& R# b( A! j! g5 q
6 o; H# [, a% \. G, P
0 {- I0 i6 h6 t7 D1 |* F& \
( _# Z* h7 R0 N6 J* Aint uc4560
. b4 v/ F. l4 ?(
1 U; `) i. W" c0 b0 O9 Qconst char * fspec,0 v$ I6 L! n5 w& i, t% r( O
int ftype9 `3 X( A D1 ^- n6 K
( }' B$ l9 P2 q/ r
)
: k8 H( ], a7 s/ X; w0 S. g& c" z! g4 c' J( A
const char * | fspec | Input | File to check | int | ftype | Input | File type4 M) ~2 q8 x8 K0 H
0 will check for files! V$ y% S! _& ?
100 will check for directories | 0 K2 ^! z) D$ f% o
6 S$ Y4 ~1 X% B: W+ I. C2 o$ B/ X( S$ R& N2 ]; d4 T4 _* ?$ b
查找文件也可以通过UF_CFI_ask_file_exist
8 H& ~8 C7 ^0 e. m: b, i0 G
' b2 E- G7 T3 T8 mUF_CFI_ask_file_exist (view source)
" |- P) O( E3 y, t0 h) o 5 a+ n' m: H- z" O+ a% k, _
Defined in: uf_cfi.h
: K3 C# I3 k k / c- {/ x. B5 {" r; @
# ~+ y) y% ~: z7 |+ i1 LOverview" D: T! {; f0 H8 b
' q, k# I# i% q8 p0 v
Test if a file exists.
5 L8 [' k- F+ b# p8 C7 V( p8 h: W+ L1 _( n, J6 m( U# [- F
Note: This function only works with files - not directories. To check if a/ V- i9 y) e$ U
directory exists use uc4560 and pass a file type of 100.3 e9 O# M2 D2 d( ^- v7 W" A& t% I
# { Q( W" _% @& z; n
3 I. I' i. V5 `5 Y- c& u5 DReturn/ q$ _9 T: ^. b2 e' L2 O# K9 C
& z. U" p% R9 c0 c0 - No error
8 x8 N5 T8 x$ U. s% ~/ k& Z8 iOtherwise - Error Code3 R! |3 T0 c* C p& N6 c
4 w4 V5 n7 L+ s
# R2 O; p+ i& P
Environment
7 I. b4 U: }( H& K' [1 S% k; Q' k, S
Internal and External
3 M5 }7 I x3 N
9 k+ Y0 h% p! m4 n, P) W% }7 s, C7 x# G; h7 i6 y
History
' J- p2 i5 M7 `6 p8 J: a
9 d! O1 I4 u+ e, ~- s6 `Originally released in V16.0
/ J1 ?( a- l6 M: j1 {7 E1 u ! Y/ s. O u5 f. N! A# B$ |5 X
; k- t0 s* z6 @
Required License(s)
- g8 l6 F4 i$ o7 T2 M' [' i$ ]
. \0 i9 {# ^ \9 F3 Kgateway/ j+ `* t+ S3 l# p
& V- q6 @5 p A6 e. s# y/ i# W9 V' E, V- @4 K" K+ Z+ _
- p; N3 t" y( l1 }
int UF_CFI_ask_file_exist
; H( {) L6 o0 `" n1 h2 j6 t- T' J. a(4 z1 N% b1 u9 }8 f
const char * file_spec,) S- Q# \/ j; S P6 j( w+ m
int * status4 ^0 M0 d6 R( [ ~6 z$ z7 v
9 N5 W2 k; D6 w+ o% j) r" k
)
" s+ L- w" g9 u$ Y; i, Q, g: W6 B& ~3 P5 F7 F# [
const char * | file_spec | Input | The file to check | int * | status | Output | File existence status.: X6 x5 D+ r9 T; E& k! h
0 - file exists2 {, I2 `5 P# u; B
1 - file does not exist
3 d! l* o( l4 A6 o6 c( H# c- v8 |
5 o- l; r9 w" D4 @# C4 d! U |
7 C. k: s0 }& A& y |
|