|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
# B/ U: Q+ V1 B7 ^% \" k
, s( m$ j5 C, G, c在进行相关文件和文件路径判断时候,ufun提供了内置的方法。, H8 R5 p' x; c5 V
UC4560 通过设置第二个 参数为 100 可以判断文件夹,通过设置 为 0 可以查找文件。
" z5 s8 U; d* }' ^' I; E0 G6 w* B7 b/ I9 M+ y: o' Q$ b
* w9 T0 i8 Y; s# M0 n8 ]9 E2 T) A2 f9 C2 D) `* u
6 _4 A. s+ S" x% o( Muc4560 (view source)# k. |- P! H7 ?# w3 h8 f
% t# Q6 w; ?9 mDefined in: uf_cfi.h" r: a e7 W( w
5 S: a$ N9 a: X- ^( Y9 S9 T. c& m( s
Overview6 q/ S* }8 {6 m
5 ]0 G1 E* s! S9 F5 n' M
Checks whether the specified file of the given type exists.- L, M& ~6 U& B2 m& |& A* [' u
5 u9 }* p+ S" k! J4 o- ^& Z4 _/ {NOTE: Mixed or upper case file names may not be found if the9 A+ ~% G/ f$ s7 a- y* A- V/ M
environment variable UGII_OPTION = LOWER is set.+ h# x% D" M, }; c4 q0 w, P$ L
+ a7 J! f0 y* y: q6 W4 j, R2 D. I' {Passing an ftype of 0 will look for a file but does not work for a directory.
/ Q; r( }* i. uTo check for a directory the ftype must be set to 100.
2 q v! c; e# ?' [; ~ F
1 h$ S2 q% ?. a; H. c+ U8 ^% o0 `0 s
Return- l7 F( T. W( H6 V5 V
; E+ z# y+ ^8 w" R8 C6 _Return code:. M6 Z2 ?9 a. ^% r, o
< 0 = Error+ ]% e- C' E- f9 T7 @# h2 U
= 0 = File Exists
7 z# T9 K! D5 `7 @= 1 = File Does Not Exist, c! M* z+ R2 `
2 h3 f' p$ v- s8 G1 j, C+ ?
# M1 M# z- V/ V }1 u3 y; z
Environment
. G* T3 J1 r9 y5 s/ t
8 V8 ?8 Y6 O" f) D/ wInternal and External7 r; Q$ h4 ?, t
3 z8 ]2 S0 G1 V) D
- O0 o7 k m! l$ l! `7 M8 ~See Also/ a: T$ Q% d# ^6 V; M
6 [2 C# |+ b% h- d# v" Z* GFor description of file types see table
# ` F* s8 L3 V5 W* e) M8 L 5 f" d( O3 K- i" i/ r+ R
. j% t7 j* ^8 E6 \, R4 P& bRequired License(s)) a0 a2 a @ _- }
$ j g9 A$ `) @8 f! z R% t1 T, `0 f
gateway
- o- N+ b' Q" @' x# N, O& |/ i0 {/ d1 {. b/ Y
& v* k, r8 m; a6 Y5 E" C$ ?
2 [5 P) o2 A$ Gint uc4560
J) b8 z) D$ a7 M ](0 l; ?4 D4 a6 z9 @# f
const char * fspec,
% t) J/ `+ s/ ~/ @int ftype; l$ I: Z/ o5 {+ r- R2 D
9 W( {& I, L' ~3 u# C# k)
8 ?% m/ H9 l1 h& b, c
o7 ^# X2 E# I4 `8 L| const char * | fspec | Input | File to check | | int | ftype | Input | File type
% B: X9 ^& W9 e/ T0 will check for files
6 j* `) a: L1 B- ~' s! h100 will check for directories |
3 D8 q2 m$ z% P. Z p* O
3 P5 a0 x$ t, c+ U) @6 q9 Q1 ` v2 g q; | l% L# h* v6 `
查找文件也可以通过UF_CFI_ask_file_exist
+ o1 G. E* Q3 U8 F X% M
% q; T! H0 v' H; t0 kUF_CFI_ask_file_exist (view source)
& ?1 m8 W, W$ r8 V; n. I) ~ @* d R8 p0 @* D8 d( g2 U
Defined in: uf_cfi.h
4 R6 C& {+ H: b. U3 o, W8 c
) d- Q8 k. x3 ^- q1 w0 l9 ?9 W; W. k
Overview
6 c- t. C! c+ ?8 `. @1 x# S
; l, ^) M: x* R- @2 _Test if a file exists.
: F7 J9 C+ k; g2 _' b+ x# P) W' T o4 j6 F. y
Note: This function only works with files - not directories. To check if a
8 Z2 `, C8 U" t A2 s0 ?! zdirectory exists use uc4560 and pass a file type of 100.1 x1 O- ]$ P# F! Y
) N6 `; t; M8 R# b. j# f) j' P; r% F
" C, E; z8 @2 ]) Q) pReturn0 S( M4 L ]$ h! l
8 L( d( `2 y6 {) ]$ ?- Y* N+ O& X
0 - No error6 f. Y1 V2 o, D* Z! m8 @
Otherwise - Error Code& ]# l, c( D8 n( r5 v& T
3 t2 g1 A" I6 a: b. R7 O& m
9 H* C9 E R" x! U! J0 h* bEnvironment$ ?4 p4 _1 I# h7 }
( X$ T3 o) E+ \1 X% w% AInternal and External
# _) X, Z) U1 j- _2 l Y, @$ ]7 d W6 e0 p2 r6 V; `4 Q3 u7 _
$ ?3 O6 D- N# F# sHistory$ _& F t0 F+ {
, z1 d6 g6 k. {7 y/ m8 mOriginally released in V16.0
5 u2 x5 }/ E8 A$ K A" P- S: i 3 S' F, `: O( v4 V
/ r2 J3 }7 Q% v B) C- T! N. `
Required License(s); m7 |) x8 {2 Q+ @
1 V' ~1 t. d; X* x5 |* kgateway
7 [0 |! m1 W) E# f9 S' Z; C! u& s; E W N3 e0 ?& g) E, b
T- E9 I' L' o! x
: _$ U) u9 N# Yint UF_CFI_ask_file_exist+ _0 c/ v u- }8 s, |% r3 ?
(6 i7 l* E: U2 r W+ u: o8 N
const char * file_spec,8 w4 |. J& {( T u `
int * status
, ^: d! ^ | p6 J- h
+ {" H; |0 d: `' T# r)
6 W' X* F) X; x
% s* U2 @' z1 W# {& L) S| const char * | file_spec | Input | The file to check | | int * | status | Output | File existence status.
3 `, [/ R, c, l1 Y$ q' S/ `0 - file exists
( b2 S+ g7 x. l' L3 ~9 n5 T; U# H2 K1 - file does not exist: n+ ?7 X# q3 u4 t9 }
& F" c$ y1 H: N# s! t k' r
|
/ w" q% L( g& V/ E* o1 V, i |
|