|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
. q+ X9 X' |/ X: \0 j! e8 X5 Y4 Y$ ^. g' A, o2 U T
在进行相关文件和文件路径判断时候,ufun提供了内置的方法。. k& |$ n& o9 m9 G0 w6 N8 W: h5 H
UC4560 通过设置第二个 参数为 100 可以判断文件夹,通过设置 为 0 可以查找文件。* E$ k! C3 v: K5 t+ Y5 ]$ M* }( s
" U$ a: I- a2 D3 a" I: x
) l W q- a) k8 j1 V3 R0 i$ ^3 j( P7 }( g- ^ n& F
% {2 G0 D) }) U! y: x
uc4560 (view source)8 u) I1 |. }# T/ @+ C
! I0 |' W! V! d# d" u
Defined in: uf_cfi.h& k! `" e4 }3 g7 s
$ m; Y0 N; k' [5 o, f$ A8 Q$ k( w4 d! R! ]2 Q, z( K
Overview
' l {9 E/ f0 g3 |4 }2 u" B
( q2 a, x4 [ k% E( v5 c) u5 u# LChecks whether the specified file of the given type exists.8 o9 K7 l4 k/ }4 k
- u3 k4 h! s* H
NOTE: Mixed or upper case file names may not be found if the
/ ~! u" I, J ~7 Aenvironment variable UGII_OPTION = LOWER is set.; n$ w" g! J( ?
4 e `0 Y) u: m, v: B( APassing an ftype of 0 will look for a file but does not work for a directory.
" m( p* U) ?9 z3 a/ f( gTo check for a directory the ftype must be set to 100.
# [0 s }! s1 i2 v$ U8 M5 v, u- t3 ]! j6 r( q/ l3 X
# O% P/ p" `; J6 j Q! W1 HReturn, C6 {; ^5 }( @ B* R5 H: J" Q% S
/ G5 H6 c" L% X7 o+ X
Return code:5 o+ \: ?5 y; |. u' g
< 0 = Error
2 s. a$ p2 ~3 R= 0 = File Exists
* h4 V1 L, Z/ ]5 w$ I6 c! z4 J= 1 = File Does Not Exist
: F2 F. E S8 Y/ d9 [4 j) v. j& H; n8 p; {/ V4 Y a3 `
9 m6 S& Y$ v8 @9 c/ q; t9 _+ {* D5 h! lEnvironment: k8 }. F7 B5 A. ~! F7 R% l
* h: ?( F. V9 V- b* u7 i8 I5 T HInternal and External
3 e9 s% \$ V3 I* W6 h0 g9 Q/ B5 u' b+ _; ?5 M) F- n3 a2 ~9 {
7 R4 C/ G; {) B5 B, F7 Z; {; R- S. e. XSee Also
+ _; b$ `' a v
0 U' i4 E0 m" K5 g5 ]0 I( x S& }$ _For description of file types see table
X& Y; V9 o6 ]0 l; @
2 V0 Q9 J: O: W; p N0 Z- w! ~
+ @' }5 C8 t6 W6 b" BRequired License(s)* c/ j2 [* V6 g
/ H) K2 Z% W0 Y5 m1 vgateway8 W, L" \4 ~% {
# `# E# n' f) H9 Y: j: t; n7 l; s2 P C7 }
0 q/ A& L3 u+ V* uint uc45602 `1 f: s0 M f$ D9 N" S! ]4 R
(
: r4 }5 ^% f4 I, D! P: h0 |const char * fspec,1 l* A9 \" I# z; [9 \+ o
int ftype
3 w) U" l# k* f9 u$ J
, [9 O) e, Q6 s- D# h: B)
. Z1 O1 ]3 B" W3 h# c' @4 i2 I- h$ Q$ A: `
| const char * | fspec | Input | File to check | | int | ftype | Input | File type" }9 |4 |5 f6 _+ _) k h+ W
0 will check for files/ ]9 P, U" s, U! a% w7 O5 P& ^
100 will check for directories |
6 m0 k" P/ H( }1 g* x6 J& y% I, u4 m Z5 k. v- a
, y! s( g2 @! _8 C0 d. i查找文件也可以通过UF_CFI_ask_file_exist# r, L. d6 B1 g7 s
3 x5 j8 t1 W& S' W0 s& \UF_CFI_ask_file_exist (view source)
' C' F3 ]; [, {. ~; B ! J! j5 W, ]* t: V$ _1 H
Defined in: uf_cfi.h. o- l: t6 s2 q( k! r- i
$ E* _5 w6 M, Q) ?8 U" K% Q8 Y& u6 D+ A, ^
Overview
4 I% ]* P9 v. g( W& Q2 ]! q$ p: w8 M' I i! }- ]
Test if a file exists.4 J* P9 ^% w0 [
. f6 ~" [2 k- a& r; hNote: This function only works with files - not directories. To check if a
) O9 p1 ]0 Y j, ~0 }directory exists use uc4560 and pass a file type of 100.
* ?' h2 Z) u$ t* _' z% g4 R r
, c, O: K# j# s( L) |( |& F
. S9 b& L/ }! z2 ~" k zReturn
3 D+ g4 J& ^: ~; ]+ T
, M! D" k/ o" e V* O! L; O7 p0 - No error
. l! h4 [5 }# I7 rOtherwise - Error Code, |7 B: |2 ^# |0 q- d B
4 g. C! o# O# f
9 S8 t; b, D" K1 g4 s7 WEnvironment
' {( ?+ c$ ^) w5 ]1 t2 y1 U
: q) i% v# O1 TInternal and External
" m$ I) f8 D% Z) `: W& ?5 `5 m5 w/ B) B, ?: M3 S3 { U% ~3 l! U
& F1 M6 a/ {0 {4 s! k7 g6 J+ V* ]History
0 b$ \8 d% t) g5 m9 Z l4 R' I n9 V4 ]7 m- s) z- \2 S
Originally released in V16.05 a7 \! m% z. \/ r4 @) A
0 A F5 X/ G- _0 H' o
2 f4 R7 d, I1 h* u2 v2 N" i) v
Required License(s)5 G5 j+ y/ W0 R( u
7 w5 b9 a! d u3 S: O. f
gateway
0 w* T4 k4 f% l1 T6 b; a6 d$ t( B4 G2 [- t( }
0 L" L; _, K/ ]( j( q* a / r0 s3 T2 s( n3 w( V* O. S" a, V
int UF_CFI_ask_file_exist! z( @% u4 c+ D( x9 R$ l
(
" }0 {. Y% |$ H1 lconst char * file_spec,0 L+ d; v( R: P8 i
int * status3 D$ z* m7 P5 r+ ?5 p E
! I3 @! o( w" M, z; S6 T
)
) ?& W0 N4 J6 G7 `% Z# l4 t
: J2 y6 l+ E' o3 @& S3 V; [| const char * | file_spec | Input | The file to check | | int * | status | Output | File existence status.
& }. \% z; q; v" O% M$ W0 - file exists5 w3 w% A% ]* z* j
1 - file does not exist
! u6 c8 [( a4 f. Y* r7 m
" u0 [! c$ B3 F Y9 n) I |
+ Q6 g: U) o# n" |. F% ^ A |
|