|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
' J3 b. R, s5 U& ~5 E8 U/ R p
6 R% ~0 _; l; u7 {) P' T6 s在进行相关文件和文件路径判断时候,ufun提供了内置的方法。
! o3 T. c( F; V. a6 vUC4560 通过设置第二个 参数为 100 可以判断文件夹,通过设置 为 0 可以查找文件。
+ N8 X9 T2 ~/ R/ w+ `- P' R. B% |" s2 u& d+ n0 o4 m7 n% O6 d: B
E6 N0 G3 z( n- i0 z
6 O) U! [7 M; Q1 x' P5 y
! j) j( u* q/ _# s7 B; O* kuc4560 (view source). A/ R, g5 P$ j$ y
- ?9 c, x7 X- w" i6 `
Defined in: uf_cfi.h1 G6 z9 X* N9 l8 }5 S/ v
/ J% o _2 b8 O
0 g! H$ a$ l5 {4 _# C, AOverview
4 J6 d' f& s& l9 K/ |, x
" ?: y' s* n6 q6 u2 T0 A6 _Checks whether the specified file of the given type exists.4 w$ Y( H4 t& O
* T/ W; i) S9 b$ E; g1 J
NOTE: Mixed or upper case file names may not be found if the
) g8 p* v) a% ]5 j3 m/ h# ]3 Genvironment variable UGII_OPTION = LOWER is set.
3 ]5 u1 Q: t, H* J5 W
3 R; g, B/ I! \8 Q+ t( HPassing an ftype of 0 will look for a file but does not work for a directory.1 `7 ?- E8 ~) f+ Z8 m
To check for a directory the ftype must be set to 100.
1 E: @9 F; G+ o" S T5 ?# ?
9 @+ j. {2 Q4 z$ K$ E$ ]
8 a2 {8 c1 _3 b- }Return
# J! F- s# Q! k. a" g9 l+ W" Z! z: L5 m' _6 }$ a! w
Return code:
/ G# v1 T1 |/ h5 x9 q- H0 x< 0 = Error6 g% `+ F0 u- n8 r, d* H
= 0 = File Exists6 _! B3 e5 V8 {$ ~& [6 `
= 1 = File Does Not Exist
+ n& N& B: m( P8 B8 _
7 F9 O0 N4 }, w6 G- f% r
% g3 v5 k0 M# Q" s! L) KEnvironment
* c; V: b$ ?: w) [# F# i( K* T3 c* Q) N5 o
Internal and External
8 I7 G+ H. n' S2 l9 }+ I
, t1 w# P3 A9 V; U: X( `5 E0 o; a0 a. v% K2 d( U
See Also a( h/ P) k7 d, j
, C4 `# f( a c V
For description of file types see table
( B4 o! l1 x/ V/ x& v; P' F6 ~/ I . ], R/ L: n1 }. y# L! \# t/ h4 v
e4 T2 x5 `% Y; x& z( T& z/ b+ \Required License(s)
" y [7 l% f3 f8 j0 i1 J
0 l( s( P8 T( b3 V: }- n6 X- Ggateway
; s0 T: l3 c7 d; X/ |+ b( O" j) `% v! f% Q& z
- a8 m! T: c4 `9 q* Y8 q5 a3 W
. _1 r3 z( v' P% U- E, ~) X kint uc4560
n ~0 ^8 b; J, T+ O/ b6 P; H(
. D7 n% m. r$ d$ b$ C) W8 U) ~) nconst char * fspec,: i% v1 d( ^4 y% r& j
int ftype
* y0 ^1 [6 r. x2 c3 p- d6 S0 H" {) j: K
)
. d! ~! L, v# V! b7 s1 R: w, R$ ]- k) |
const char * | fspec | Input | File to check | int | ftype | Input | File type' p( Q' X2 i+ R! Z5 R' @
0 will check for files$ a8 c' i- A9 E
100 will check for directories | ; v% o+ t, s! c3 a( e* h2 p
3 y) k0 W" L) j# e) p1 H) F
% O. Y$ ]; K. }$ s H1 S9 {) c
查找文件也可以通过UF_CFI_ask_file_exist- x% U8 Y, Z' t2 l8 F
4 Q1 z# X' C6 Q
UF_CFI_ask_file_exist (view source)( A) X6 m3 r$ k9 u) ?
+ D* v0 P( r) i. q) O
Defined in: uf_cfi.h
- Q' i0 U0 @- J, K6 X! w0 f ' F6 h) s2 \& t8 y
& M) T& K+ N* q* {6 C# JOverview
! f0 |" p0 z* G6 V j t- K
# k- w6 j, c% R) H$ \1 TTest if a file exists.
4 w# u, ]% L+ N% e# }9 Z! @
0 r. e9 X1 N0 _" n, d+ P& `+ RNote: This function only works with files - not directories. To check if a- ]5 v- A7 F6 @; N* j r- V
directory exists use uc4560 and pass a file type of 100.% l8 b' J+ c: D# s4 t
6 H, D, ^- D: ] J3 i4 R
! ?' b' O! ?3 J2 @3 T: ]: o# ]Return
/ |* p. b. y- x$ a: E. l; d/ x
. ?, |/ [1 l3 A: m. n0 - No error
- d# \% f- j7 V3 IOtherwise - Error Code; S" C$ A9 x- |& v
9 H4 ^% B+ i8 k) K
6 c+ d& ]- z9 r$ U; f( REnvironment
& i6 U5 ^+ Z3 D+ y. ?" @% q& L7 E/ A6 S/ L
Internal and External. f! S. U# E1 ?1 _3 I; e
/ }4 A. E$ v( _( P5 G" P! ?7 g
0 Q, e Y7 O) `9 m: P+ l yHistory# D& e3 S p5 K, _6 R2 A3 m. X
- L* M: a/ Q* l9 d4 b8 KOriginally released in V16.0
- x& s; q( S. z2 m! Y; ^
! R- p1 l9 K6 N
! I, f; ?" u* X; [Required License(s)
+ ] S7 k2 g2 S! r! L
: W! I" O e; X% Ogateway
$ ~, |, Y n! k4 R& e* w) h* j" B' s( c6 W7 ], m7 ?1 ^% n2 a2 v
8 g; C' T1 a) h+ e2 o: `
4 b; a/ b0 s M) Z8 H0 e' T
int UF_CFI_ask_file_exist$ @5 h: i) _5 w! k3 E
(
P% u5 @% C+ u. h iconst char * file_spec,
! |3 P5 L% E# A0 k6 W) b+ b# P0 @int * status
3 x z" i7 y" L: ^# v; w( w4 L. S( q, h8 D! H P9 L
)- P+ Y/ @5 Y- D! E; j1 K# E+ @
: q" C/ p* z$ }% W
const char * | file_spec | Input | The file to check | int * | status | Output | File existence status.- ]5 Y" g' O5 @" s' N$ Y$ R6 d
0 - file exists$ n' u* }/ u% c4 ~
1 - file does not exist
" e' r8 P3 `3 J, _$ b! d
$ x$ {* G0 G9 C+ D! g | . z1 t+ W; q, S3 \. P
|
|