|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
5 P5 ?( Z1 c9 i3 l8 ]) Y8 E) F7 p4 J0 J6 b5 {2 ]: P9 Z6 J+ F
在进行相关文件和文件路径判断时候,ufun提供了内置的方法。4 a" D/ ]# q" s0 X I
UC4560 通过设置第二个 参数为 100 可以判断文件夹,通过设置 为 0 可以查找文件。# ?- [" ~8 w" f8 q1 `7 |
6 z2 }3 Q3 ]4 j0 z' t7 S
/ [" k- M j, f) U4 ], Z: h
8 n$ B% m! \$ A6 r7 R3 H% w( |
! a: e2 p- p- f( y( @& Uuc4560 (view source)* J: _3 y. ~- P0 x. y% Q
' w* E3 b; Y( z& E) [# M# Q0 NDefined in: uf_cfi.h
( {- J; f& i' x; W3 ^ 0 _7 G) C2 X$ w0 H! w6 y6 V4 P
: _! ]$ E5 c: y" D
Overview
?( x$ O6 ~8 B5 k5 {: o
) F$ n1 _& J# sChecks whether the specified file of the given type exists.
9 L; n+ [( }) \0 |3 ^& V! H' t4 |( e! L) O/ E; G
NOTE: Mixed or upper case file names may not be found if the
+ E3 u4 C" t7 t* z' G6 k7 Ienvironment variable UGII_OPTION = LOWER is set.
6 ]) ~( c, J+ ~( W7 ^3 w& C2 P1 H9 O; i# H2 F
Passing an ftype of 0 will look for a file but does not work for a directory.
5 Q8 t% z) B" U, ?( gTo check for a directory the ftype must be set to 100.
& d# k& D6 c7 p. b2 C( _& }* l
- A0 c& D6 Y9 b& _/ O5 F) x& g" ]3 J; g4 b2 R0 p! O
Return% X6 c! \- C5 x3 ]/ w6 m7 z9 ?
# z: V1 @! w9 S6 R4 V1 U# M$ w: |- FReturn code:
, l4 c' A8 E3 K- d6 G/ v< 0 = Error: c: h1 y! [/ F5 x7 A8 ~! u, M7 M2 a9 C
= 0 = File Exists
E9 t+ k4 B$ }+ V= 1 = File Does Not Exist
9 `+ g2 C/ p7 H# `* e0 x" L, Z+ Y% K$ W. j: R# y/ _& t
) `: O/ q' S( F4 EEnvironment: K5 h) B" u0 \$ f- P, m5 v/ z$ _8 A4 j
$ d+ a* c1 K" ^# D# |
Internal and External ~& }' V& `; N1 b* a
1 T: N. i$ E' p" ~+ n) x3 N, x& S) R; O7 M. k" G2 w
See Also
/ G" {7 r! O2 [
* M5 A! `0 I( H. V2 R( V* hFor description of file types see table
; Z9 J5 k9 Y( P; ]
7 L. G# F* X0 [* ]" l5 T) ^& U/ ~7 j, D9 ]9 S3 g3 k+ W
Required License(s)0 m2 [% ?5 j7 b) j
+ h5 v& X0 S. @3 f5 B1 E+ pgateway
) x4 @" n; u; t9 ~* d l
b) r5 T$ V6 J$ U" P: w3 o6 q$ t# R- x a
9 h+ i% }6 v! N; C9 w
int uc4560* p* u) `( d* |( l9 i% g: M) c
(- X9 E$ J. \! v7 M) y) C2 e& }
const char * fspec,
5 C) Q1 l& R4 @- w& |) ^' N9 q* U& aint ftype
/ A0 X l Z6 W) [& x# V& u2 W% g% ^7 @! Q: R- }8 `7 l6 R' t& f
)
7 F6 B5 R/ @' S) _( w f' [2 y+ ^) n5 l
const char * | fspec | Input | File to check | int | ftype | Input | File type
' R" \# ^# D1 E1 r7 j0 will check for files
* j8 Q" t; F( s% p8 \100 will check for directories |
( L+ K& x$ X8 @, Z& v1 r8 s1 }/ m2 P: G7 {' e9 m7 x' t' M
6 M! D/ G& Y& [' c1 V& Z查找文件也可以通过UF_CFI_ask_file_exist
2 W+ U, J' G3 F. a# o5 q* l7 f) R' A$ C* D5 i9 n I( J
UF_CFI_ask_file_exist (view source)
% o4 F. h; Z! s+ Z ) D# V% |, o6 d' K& W
Defined in: uf_cfi.h
' L5 l# `( r# a- m : B0 U( L5 Q# V) h( h. H9 k) i. p
& F+ F( ]" Y- G+ c5 I
Overview; W/ N* C6 F( X: c; E( O* J# V x
! A* ]6 V( Y7 s2 zTest if a file exists.( d! D+ Q2 y* j+ E) J5 z3 z
/ x3 g+ n7 A R! F
Note: This function only works with files - not directories. To check if a+ h$ {$ c$ p$ E$ }9 U4 t! r
directory exists use uc4560 and pass a file type of 100." ]6 r/ c% k! o' k/ ~
# f1 G" }/ U" R, b1 K- p$ r; }' r2 @9 x: r, O
Return
7 N2 S \ @, c6 H! U
; e2 B( y7 |) X5 U+ I0 - No error+ r; o6 B" X1 \$ g1 @6 i
Otherwise - Error Code6 x* K4 o7 ^- A
9 k; O0 H. }4 T) _" v
3 C+ Q) n; d/ T6 @Environment6 @! N4 p0 z% X9 e
. n' C! F J q; O |/ zInternal and External
4 h! a- U' @3 M6 n& T& a* i8 P3 ?+ a& q! Q% m& Z) R# r" F
4 M3 z" s d# @: m2 X3 HHistory; M, H/ J2 i7 G. |/ l3 e
; B; ] h$ D8 t! _" [9 P) B" G D
Originally released in V16.0
3 X3 K% @. w, y" R' M3 D# o & Q+ s! Y' k$ _
' Z1 M9 t3 E" S) b+ u2 O, bRequired License(s)! @" x7 ]+ ]6 {( C; r0 z3 F
8 s, P5 z) g) _0 O7 C: }gateway
( V7 B5 M9 H7 }' q0 Z6 a' p6 B& f0 D! D" o
/ F$ k+ J% a, U) `3 I ( }0 R/ f, t/ c5 B5 k6 v6 p
int UF_CFI_ask_file_exist* g! j8 {% {+ a) y
(
$ B# k' m9 {5 m( ~, Qconst char * file_spec,# G0 `4 Z* F" \! N) w7 {
int * status
2 n) `2 z5 h. H0 A; k; |2 I4 }+ ?/ x0 u6 Y
)
0 K. o5 z# B. E# {' w8 q; P: k- H9 C9 L
const char * | file_spec | Input | The file to check | int * | status | Output | File existence status., f, m7 u4 ]0 A
0 - file exists
! O5 r% z: c5 x- N+ Y1 - file does not exist% |, ?0 F& k& x( c& |
2 e. y& S+ G; t) |
| 1 ], [# b- _- @, i
|
|