|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
7 ~# t7 _0 Z9 C/ `& W( `3 e' x. `
# s( x3 ? D0 L3 w# o7 J: ?, _
在进行相关文件和文件路径判断时候,ufun提供了内置的方法。4 b2 X o# h6 ]
UC4560 通过设置第二个 参数为 100 可以判断文件夹,通过设置 为 0 可以查找文件。
, T1 u8 y( {& P" K% M) M+ f
' ~8 H* K% G7 w2 J
( C- y. b8 r4 g0 i: h9 t& F! t
$ o( k1 M E2 e% v. n" d6 Z1 p( V7 Z$ E* A& q
uc4560 (view source)
# B$ e1 [4 `' b* F* e : S7 T# v( F, ]$ b' H3 `' c
Defined in: uf_cfi.h+ `; b- G0 } A/ d+ X9 _5 H$ g/ a
2 r2 T) e2 H5 q V6 ?. J8 p3 Q
5 V- K( ~: k& X; ?: ]: m' r: r
Overview
+ T5 U# ?; G! y! o5 I4 X: e3 W4 L3 Q7 t# ]* ^: {
Checks whether the specified file of the given type exists.
$ Z* v# j7 K1 f: x* Z
3 S1 J; w' r4 s- ]" W% K0 INOTE: Mixed or upper case file names may not be found if the
. Y2 m$ f9 H# E+ ^: qenvironment variable UGII_OPTION = LOWER is set.
# c @! b F0 f3 K t
$ t5 } f2 m; O' d. x9 uPassing an ftype of 0 will look for a file but does not work for a directory.% M6 }( e+ [7 G' r4 {
To check for a directory the ftype must be set to 100.
8 H7 d4 \. s+ j9 I' I( M6 n9 C R6 h* M& N9 K! o& Y. R
5 {$ i, w* E @! X2 T
Return
: x9 X3 }) \# d7 L: l4 ^& N3 e/ a$ A( K+ N' T+ W
Return code:
" S# P4 }& N) o$ r: u< 0 = Error) Y+ v. O6 R8 k/ l
= 0 = File Exists
8 u$ Q3 y5 T; B+ {& l6 T5 |= 1 = File Does Not Exist% K2 G0 [6 Q H+ I
) {, o$ l* n2 Q- r3 F* m
- a( v i2 W. \& L* t
Environment5 l/ j X) K5 \; q4 Y* M( v; X+ F
# }& l0 x0 Q5 J3 Z" C ?/ t
Internal and External
+ K S% _; F2 H
5 [- ]1 M. k8 P4 `2 Y/ W$ s9 d4 s( G
6 g/ Q8 I; J( z1 ?) FSee Also9 u! A, \" t- e* ]: c$ |, a
: W2 Y- j2 A+ Z; e5 w8 V1 {* G* e
For description of file types see table
0 x7 \% B' |* [! u, C( S) d/ |
( ^& \$ B0 g( e; G. }
) R. F& J8 D2 S: F1 MRequired License(s)8 e/ \' v- W3 }; s0 u8 W1 k7 B
' r5 T- Z, |$ F0 N! U/ y9 }: hgateway: V& i3 c7 H9 ~) F. ]2 ^2 |8 f
; T+ R" d" p- R' H4 @8 n5 j! B: P5 Z1 I$ T, B0 U9 X
+ O4 }: l( r/ eint uc4560
; E% x) E. I1 S7 I7 k* d: B4 _, d(. W& m q: ?* K; e7 N9 T
const char * fspec,3 E. P2 k2 t" e
int ftype' }( L0 h, }+ Z( m: X/ I
2 e1 S( v# Z2 @- V1 N. ?1 Z$ F
)# S3 E' U' l% T. |$ Y4 _
1 G9 n* D$ D+ X E| const char * | fspec | Input | File to check | | int | ftype | Input | File type: `, q- x Y, u; \6 |# m" }
0 will check for files3 S5 X9 q5 p8 A/ p# I* W
100 will check for directories |
2 i }. d( O5 [6 {2 t1 ^/ e1 ^( d9 O E( |) }3 b4 p
* o+ @, W- P4 e5 I3 l查找文件也可以通过UF_CFI_ask_file_exist) J9 W6 f3 Q% i$ X& n3 F' E
* a* u1 v* M! _. H( r+ M$ @* C
UF_CFI_ask_file_exist (view source)0 f" D6 a) g7 o$ M3 r
/ I4 m' d+ H4 ^; @9 s: e
Defined in: uf_cfi.h
% M3 B. r2 `9 n & L& y. y' h# C* I" Q, ]
. l) r" }$ s) ^Overview
5 M# e. h' W$ `1 V: T9 [2 m8 M( V4 m6 N/ y/ z. I
Test if a file exists.0 w; ~! \/ ^" @, i# N, `
+ Q+ z! A; V# b4 L$ b+ B- YNote: This function only works with files - not directories. To check if a+ H1 h; R; p7 p% d+ f1 Y6 a
directory exists use uc4560 and pass a file type of 100.
, W X# Z' n4 g1 p3 f; h) m: T) z# H; p0 Z
4 N0 l! {8 s: K1 t8 j( }9 |
Return- A. Z; n! v3 ~, `
- Q; N: j+ O' l8 c0 - No error6 K3 z. j; M" u: ?) y: [
Otherwise - Error Code
# }, S1 Z0 `/ W! ]5 K- D9 G, a- E3 Q7 _- N5 n" M$ T3 J+ h
0 m6 z% \9 N6 [; _- v3 {1 u
Environment
9 c) u9 x# K& F: Q/ G
2 }1 d) X& h9 HInternal and External
; G' E- S. ]" p1 c: H- I) p4 d) x2 o: y) z: `$ K
3 e3 Y+ Q8 {2 o" R5 ?. rHistory& n! U1 e0 L; `" Z
! b% r4 X2 P, j9 c, o
Originally released in V16.06 r/ h& P# R! E
% R6 @$ ~0 E& p2 c/ u
# q/ m2 P! U* R! G' ]% sRequired License(s)5 l& p# }5 A( O$ Q9 X8 C
6 l ~8 b7 q' z- l9 V0 agateway
' n; m, U+ Z. L( F; B
+ {" l ^( \5 T/ D
1 \( O- c. ` ?1 ]9 h+ m
* b/ I1 @3 G6 \% Sint UF_CFI_ask_file_exist
- Y0 u$ x7 X+ T( E8 W: G0 {(
, g2 b' r, m+ v1 \. J6 U; rconst char * file_spec,6 c) r7 \" f$ ?: V! d3 f3 ?
int * status
( {, ]& j% _$ t/ f6 j9 b
! T9 i6 { O0 h- F)
: _7 B3 o7 L5 e3 |6 Q4 }8 M, E+ d( T L( Q; m* Q
| const char * | file_spec | Input | The file to check | | int * | status | Output | File existence status.) e3 H! a( c1 r' j: a) E7 A
0 - file exists7 n4 Q- L; ~) @9 R
1 - file does not exist% Y& ^; d1 y# |2 I$ t2 m7 ]: Z+ U% R
. A, W# ?9 Z0 b( G/ @
|
/ ]$ w, }2 o* p( i |
|