|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
# k8 N- t& o3 e$ v
R0 n. _& P. o1 w# m& X" B) N# X# y在进行相关文件和文件路径判断时候,ufun提供了内置的方法。) o |# o2 P( p0 m. S
UC4560 通过设置第二个 参数为 100 可以判断文件夹,通过设置 为 0 可以查找文件。- ?* h2 |/ a7 h! i/ `' M3 b, h' n
0 F- K1 v/ a: I4 W
- f. I+ b# O5 A& W4 S1 g, L
+ F; T6 g6 a% C* Q/ Q! R' J% _7 U. Y) j7 V m3 X
uc4560 (view source)
2 r0 L+ T6 y O+ Q0 I" x% j1 A
! h! e2 w- r0 B# h. A3 wDefined in: uf_cfi.h: z" @1 c) Y; R7 e" D- p' |
% s0 ?- x! ?! O) l
- P, p. i* N& p) v+ TOverview
1 Q$ z* p9 k; W5 v2 z$ v; j5 |3 _9 f2 R: \4 w0 Y( z
Checks whether the specified file of the given type exists.
3 d w- M4 M; D$ g( H9 p8 \" u! U5 H- K
NOTE: Mixed or upper case file names may not be found if the
0 ] [: W T+ s n! Z( @environment variable UGII_OPTION = LOWER is set.- c7 C' W) a. a8 e# p
4 m/ V$ G6 d/ _8 [9 k. D$ u. A
Passing an ftype of 0 will look for a file but does not work for a directory.8 j0 b: f; Q4 @3 _# @! \! a
To check for a directory the ftype must be set to 100.
/ d" v/ p" d0 G2 R
1 B& z0 u( {% O+ n7 o7 {- e
& c' v3 }) U+ p' g+ YReturn
N) \$ [: P0 g# T% ^" Y8 r4 s- T5 j! A( u7 [, C
Return code:
; v) ^, ]$ t h8 I' G< 0 = Error! d Y2 \; I- H6 k6 p( [
= 0 = File Exists0 q% f6 Y2 x+ b* b/ k. u
= 1 = File Does Not Exist
6 ]" x7 o; `7 i/ e, Q X
! X6 }8 U! ^" j( g4 G8 l9 E2 H0 s- I1 }. Q5 z# k# }
Environment
- s2 k% ~% M8 a! V( e. q/ ?( A2 }2 m- `4 J. G6 w
Internal and External
1 z( Z$ L6 G0 ]7 ~& y- {+ _9 Q, o/ i& ~" k f$ O7 V) o
7 M( `5 ~8 j" Q+ G( a& G9 H
See Also, N) e, r6 V2 M/ z. V, U1 k
6 o% x/ {, }8 P @
For description of file types see table. @# b6 U" b. j# e
/ I2 L4 U! s( g6 ]$ _
6 Y" i$ M- \5 d" d2 kRequired License(s)5 o* D8 g5 J8 g2 }/ T7 b
, W/ {" G/ |8 Q0 P: M
gateway
1 X, V( m: u4 o# D
; r; y* {; P. t% _* B9 b
- p1 ~: C' \' Z d/ s4 v7 g
6 _' P; B1 _! |8 j: Q1 h* Aint uc4560
9 b9 S- w0 a6 D* {4 g+ H6 l2 G(
6 B9 ~0 L; j! h5 Y1 Vconst char * fspec,
2 @9 \9 { K2 Q% dint ftype
* C( ~7 s7 w9 C6 Q O. n3 Y& @
; x( o" w+ i# W4 v: I)
8 j* m) i- V) G/ \+ \' |! j/ E6 R) B) Y0 N5 u$ `+ g8 u$ K+ ?2 p: Z
| const char * | fspec | Input | File to check | | int | ftype | Input | File type+ ]$ v" t& f% J- E- f/ Z
0 will check for files
9 U" [' u2 T% ~; M V" J1 @100 will check for directories |
+ ]5 F7 Z: B# [- p, C; f8 k- u+ `( h+ f Y+ |
f8 q% X1 ]2 O, R- s, i+ @
查找文件也可以通过UF_CFI_ask_file_exist
$ g, w' L9 Q5 t6 K; L
, ]% R2 _- n% V9 D/ x. _UF_CFI_ask_file_exist (view source)
4 A3 y% A8 Q$ X; i$ x& A3 `
! r7 o; M" R6 N% }* zDefined in: uf_cfi.h
) n# i! j7 X( j
2 {: a3 |8 O/ |! L" K& ?: T1 K
1 W ?1 L% r5 m" S' DOverview
8 R e3 \1 `+ S' r7 ?. A, {+ v) ~& }! E( D l3 [) k( v3 \
Test if a file exists., f" Y2 h0 o1 l( I) ~) J7 T
% u$ x( F& h; \7 _9 T0 B
Note: This function only works with files - not directories. To check if a
" m) x5 e3 ?* G8 Udirectory exists use uc4560 and pass a file type of 100.
) D E6 m$ O& y9 I5 M$ o2 B6 N1 E0 v4 v% ~& O
" p3 |, n" v) n8 { r J1 o( `: D
Return5 O5 H4 p- ]# X1 [2 l
- M" \5 [ S0 F
0 - No error( K. A# G* o7 |# `7 G* S
Otherwise - Error Code4 g$ Z( _8 Z) P( i( D
$ S2 ?+ u' q) p+ Q+ {$ v5 b: F) W: x
# |" e w2 ]1 ?, i9 I5 n
Environment; p6 T* O( r% u8 s
; R; K! u) w) S/ \Internal and External* D, B4 E% V2 e* U, B: a- t( r
, |* C2 x; w; L- i
; d4 k2 J% A# q. H! `History
+ o9 c9 c( Q# q4 M1 H0 J7 i
, m: a8 M" L, }0 K/ [2 B4 iOriginally released in V16.0
* c/ f3 q' z. F" O! ] b! } ' n; M) b" `6 C
) P- j* z4 e; M: J* { t* z9 BRequired License(s)
# `/ B* S1 O! Z% F; F; P0 H
! ~8 ^7 C! z: }* f* sgateway
3 x- k. A/ W$ Y: n0 w$ }/ s. b6 L9 f9 S/ B% V2 B) g/ q, W; x
4 Y. \5 B5 u3 J & T: j7 _4 s. i8 [ p! _! Y; K# W
int UF_CFI_ask_file_exist
( v& {; V0 v" N8 ], j3 C3 n' w(- ^3 B0 Y) f2 P6 w8 G: J
const char * file_spec,$ U% ?2 G8 ]3 j2 c% ?7 z. B: m) A9 `
int * status
( ?% \4 m. s& ]3 k
/ j$ T5 ^( e n3 Y8 J0 K4 e1 S)
& `. p5 }: r, v d0 z* a8 {3 v+ r0 d) t; I# [& x
| const char * | file_spec | Input | The file to check | | int * | status | Output | File existence status.
|! ^8 U- R+ ~7 |8 |0 - file exists4 |+ ^+ }( v [- X* ]
1 - file does not exist2 l9 Y$ H; _5 M% P- u5 `! a
; Z$ o6 c& Y, ^$ X1 d1 R |
: e: n$ o/ o' s2 k |
|