|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
×
$ h# _" [/ F% R% D3 k6 m. M
( p& r& `" {* d在进行相关文件和文件路径判断时候,ufun提供了内置的方法。3 n2 W: K% `/ ~- E* o
UC4560 通过设置第二个 参数为 100 可以判断文件夹,通过设置 为 0 可以查找文件。* k; V! w( c6 a7 h; i9 ? r" `
5 i- p. J7 t" d% E- y
F* |* s- j2 m% q6 \- G) m2 b3 ^0 N. P& ^$ F( T2 g) D1 j
. e# a6 \% e) i; Z
uc4560 (view source)
8 r8 S6 E1 V& ] k / b: ^; w0 i8 Z* q8 y; ~
Defined in: uf_cfi.h' @1 U' g- {9 \+ z8 o+ k5 l$ g
& A, V: X( e1 \( ^6 Q& B4 N
0 `6 ^ t4 @8 z2 g4 c: `Overview% n5 h" L8 R. ], \! v
6 l u, t, G, O _Checks whether the specified file of the given type exists.
! F, {9 T6 H) x" C1 W! v
. A) s( ?, a0 R, @& W6 v; aNOTE: Mixed or upper case file names may not be found if the
$ G; k* X0 i. w! x4 ]! eenvironment variable UGII_OPTION = LOWER is set.
* T0 F$ d9 H3 y4 f0 r+ d, q o) V3 K( k# C
Passing an ftype of 0 will look for a file but does not work for a directory.
- T* _$ y9 x6 G2 z# |$ dTo check for a directory the ftype must be set to 100.
' S* I% c) S8 v- c: b6 O
" O1 {" M( N7 B2 v" b
* T8 c3 ^6 X1 a3 f% f, L6 PReturn8 _8 Z8 A2 b$ U0 F0 V
+ w( g9 \' x3 @% SReturn code:2 Q; U3 ]% Q; ~% |6 H3 p/ t% y
< 0 = Error/ R) ^, q2 i# L6 X' M9 L
= 0 = File Exists
9 u: c I4 `; h) _4 b( X= 1 = File Does Not Exist* d* p v$ q+ Q9 ~* k
! p; S4 J5 M, d5 y; t
: \6 i4 r4 h; v' u; WEnvironment
3 O; V" L b; h- K
& _4 U5 K3 O2 ~" r4 k8 zInternal and External- c2 w" {1 c" _3 L4 o3 O- G
/ j- a8 `& ?& l
1 o, m- X1 u' \# oSee Also
/ [; O/ b- t: k' m
. C6 ]0 g2 [2 s/ W5 s. U7 s. a1 QFor description of file types see table
. h3 k# M7 ~" w/ o. {' w# Y
! N1 m) T- f" }/ j/ j
0 C3 [+ p: T" a- l/ s4 cRequired License(s)) F4 m/ } k9 d" L+ Z
) t9 r3 f k& V1 u# f1 o5 H
gateway
% {: J; g7 g$ Y3 Q
/ ?) e) _9 O; N
# A. X3 n4 I: M' S% w ! H7 b! t3 W9 j4 G+ r
int uc4560
8 ~+ G, ?$ e2 X* X6 Z(
" P5 E& \& @ \% Mconst char * fspec,. n6 b. S0 ^0 |& l' e; z" `
int ftype) E; X# J( q5 [5 ^
2 ` l) R. ~) m" D# a0 ^
)
6 o& x+ o8 s. s4 T& s0 K
( U: L' F2 n9 I0 K. B d+ g. ?9 || const char * | fspec | Input | File to check | | int | ftype | Input | File type
6 t' \4 b3 w" C5 h$ ~ D' j0 will check for files8 _6 t: O5 j" M3 K" l% G
100 will check for directories |
- o# D+ @& Z P0 p
8 H" b1 Z+ ]$ o" X' c5 V% T4 o) m: V( ]: l
查找文件也可以通过UF_CFI_ask_file_exist; |. C6 j: k5 ]4 `: J+ w% P
2 L+ V1 n5 Y9 Y1 R8 T9 @
UF_CFI_ask_file_exist (view source)
. _6 [7 @3 S! g0 C! x+ W' k) r& V+ c
8 F$ V' j* ^+ _& Q! U# ^Defined in: uf_cfi.h
0 q- \, Z" N/ p J. \6 P , X, }) s- Y9 a* q% s. I( n8 N
4 z+ U$ v$ J% Z- ]) y. {Overview
4 e J% b6 C* B2 C8 Z# \3 |4 |/ W2 N7 X1 `
Test if a file exists.3 X+ U3 \9 S" E% A7 }& l
, @' G# |( s, v+ s% \
Note: This function only works with files - not directories. To check if a1 C: I% Z/ |. U- n6 U) `, k: w
directory exists use uc4560 and pass a file type of 100.
8 u( M1 j. {" C! z" a2 V
' K% L$ G4 o# h" q
8 f1 `# X) u* m$ r6 ]) LReturn
# V7 W2 O/ q4 K, |0 B6 @, ]& I4 Y8 q) ^9 L* [
0 - No error
9 N: A$ {4 L, x: \3 w& X0 M) bOtherwise - Error Code
. }' ?; g5 L9 d3 @1 G% D
# N) \1 v3 B8 g: u0 [- Z# Q
! M, B: e2 ]8 Y+ GEnvironment
; d1 { z( ?1 p& a- x7 F$ _+ m7 m, R a8 o6 x; C' J6 N
Internal and External
1 @6 a1 e7 r8 p4 E8 i: z/ Z, l$ _. L. Q( l' Z
: o: W7 H, U- a6 S
History
0 A: R5 u: L( t0 j# [
6 K" J3 c; q, {% h. _& _- W5 AOriginally released in V16.0
5 `+ T- E( ^, m& \* O$ D 7 W- z9 B9 a0 b
9 P0 x' Q t% [; ^. t/ T- u2 n/ q* D4 P
Required License(s)) e1 r6 R7 X. v0 v% A9 g2 a2 k
( f, ]* _* }7 q# [0 igateway
5 t5 f/ C+ J i& ^ m4 B$ p1 h. U
$ {. T1 L% C. T# J
: b5 L. R% g2 P" |2 E+ X/ c( ? ! ]* f. w8 H) E% g. a/ Z; t
int UF_CFI_ask_file_exist
/ x& [& W" M m(
: F4 l- \1 H+ [- v: c, x5 R" s9 xconst char * file_spec,
/ D' u1 z5 F/ }' z4 Kint * status* ~! G! C' x7 D4 e$ t0 z" F
4 Y: I0 C, P ?) h/ z)" o. b. j+ ^) N! L9 D/ W
+ M2 k( H5 C; a
| const char * | file_spec | Input | The file to check | | int * | status | Output | File existence status.6 @ {& J+ j; R/ O" W
0 - file exists8 L" Z# h7 A8 b( O
1 - file does not exist h$ Q) |# ]* \; j; f4 K c1 ~
& Q% Z' ?6 @ `3 |0 M6 }. `1 z; z
| ' L% X7 T. a/ [: X
|
|