|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
: `& u% m/ u, S& R1 @( }! }* i$ v& U
. ]% k# N! }: l- g
在进行相关文件和文件路径判断时候,ufun提供了内置的方法。+ C0 ^1 N, S/ ~; u0 B! B4 ?
UC4560 通过设置第二个 参数为 100 可以判断文件夹,通过设置 为 0 可以查找文件。
+ K' S3 K" E* B) z6 z+ X7 X* L+ }; G. t1 e1 {& t' P N( }! Y
t; ]$ H! T0 ^8 N9 s
+ c$ q2 t' r8 Q/ G: d4 p
7 i# T1 v* X0 _3 T# nuc4560 (view source) V. K r) W+ t: F
0 U- q" g) g ]
Defined in: uf_cfi.h* l( q5 k6 W4 F( z
% X! M* R, I- n- `6 U- _3 ^* }4 N9 S
( q! O& B$ U' s. @Overview6 F7 X( o* F" _# r
) L4 f* ^: C( k' D) p" f5 LChecks whether the specified file of the given type exists.
: W: I8 i0 G& j( [2 J* `3 s( e6 W2 j" U/ _9 U. n% U# p
NOTE: Mixed or upper case file names may not be found if the- N$ ?# G; q5 q1 X
environment variable UGII_OPTION = LOWER is set.9 d7 r& I; u4 t3 s1 L
! q5 t; Q: O* k
Passing an ftype of 0 will look for a file but does not work for a directory.
+ J! H9 W" P8 dTo check for a directory the ftype must be set to 100.8 h9 j- x' Q5 \5 T
: c5 F1 G* S5 G3 y# g% s- {% a1 o. u
2 j! p& P4 d' K; i5 \8 G& K5 XReturn
{- J& G0 \. I# \7 `& n8 f3 H; c; o
Return code:
1 @; I# E/ J5 H< 0 = Error
1 @: M7 X4 ?3 S) G5 {. R= 0 = File Exists0 W" ]5 B6 n$ Z: T- \
= 1 = File Does Not Exist# _/ d9 o, A# G8 [
/ C: Q) V! P8 A/ |4 y$ ?; n
! U& O- U/ k: A- @2 d
Environment9 ^7 S4 p- X9 r/ q7 c+ S
" T4 W% D( j, H) Y" y4 E+ B
Internal and External
/ b' \: ^$ h7 }4 B+ v5 \6 h3 `- \( \/ ~
, Q& o8 l/ p6 P4 U! L9 s; iSee Also
9 _9 C& W2 ~( B/ b2 I2 {
# D# E1 J3 N" {For description of file types see table
[* ^" z ?4 Z4 C& M3 ~1 C5 R; K
8 W+ `; ~: \& ?+ j; I, p6 o
8 E9 }) X+ y2 E) z; R0 GRequired License(s)+ I9 L0 l/ R5 J. {
3 L# T4 p" }7 h, Q' U" t9 W
gateway
% v+ N3 w: H* v
' ]; P7 T8 t% E. q
0 }% v4 f, Z2 ]4 U$ @6 Z/ R# H 7 ?# V5 N3 ]% v9 J# s
int uc4560* V1 r2 i) i+ H- |: o& b# |
(& Z, Y3 g/ G( S! [+ U1 w# F; L W
const char * fspec,
1 i _7 d. f' oint ftype: Z/ h5 Q* ~9 i# v
9 a3 v# l0 K; ^( x3 |2 e
)
3 l) g5 a' @4 M4 J: O4 u, c8 U: k+ O: _- t
| const char * | fspec | Input | File to check | | int | ftype | Input | File type
# P9 i, U/ Y T8 H( H( G3 n# w9 g0 will check for files
1 Z1 J2 ?: o* l8 I$ }1 H- E' x7 @100 will check for directories |
9 B7 W5 h3 G- w- M/ w- w3 d
: i; T( u# _) u3 y3 Y' }+ h
" ~9 S1 E1 `% t2 N' {0 H& g查找文件也可以通过UF_CFI_ask_file_exist
4 {, v) @% `9 O, z7 d+ \5 x" a% F8 v/ {' ]& p ~# O8 j7 H
UF_CFI_ask_file_exist (view source)
3 r7 ]0 }4 u* g 2 S& ~! R: r8 r9 m0 F* ?
Defined in: uf_cfi.h
# @; Y) k7 M3 P! Y3 E # L/ W, B" |- v) I+ \5 K3 U5 G
9 v, w2 h0 ~, t1 \0 ]Overview
* H& q0 v$ m7 y7 ^9 ?& O4 ^8 M$ I* v
Test if a file exists.
6 {. H, V0 }9 {7 c4 G9 m% j/ J0 R* I
Note: This function only works with files - not directories. To check if a8 p, s9 I/ z" }1 G5 `( R0 [
directory exists use uc4560 and pass a file type of 100.6 m4 B% c) A2 U9 |! l
* I1 t- a. H3 U* @8 K7 F" |1 R) d) e2 G4 E( n
Return, f6 h% o) e: k3 j5 E- S. L- Q
: ?: w4 r5 C5 o5 h# K0 R
0 - No error
. r( N! B- L$ W0 KOtherwise - Error Code
* Y, }2 X6 { ^' j0 l( |( F
4 J8 I6 m' A2 e; j5 y% ^' L7 B' }( a+ o
Environment
" c0 h; i- a( O4 K) T) [" J M1 J& s) W& Z
Internal and External+ l7 B. E; L5 \. N8 A
& N" U3 S s) \; ?! [/ }
. o, Y. ^/ S; p3 C! \7 I
History
( B2 H n$ K; }6 @. D+ \- I3 A) s4 G- j. ?4 @+ V: i9 G! P$ n
Originally released in V16.0
" J. y) d5 k! [( o8 q. a + f5 k# K0 j" s1 o5 B' B
6 Q4 j* X3 r9 m* @7 v, `Required License(s)
' y# |, T2 f. @' m' X. D+ e( n* T* n3 [2 W; a) @9 e& g. z8 f8 k7 o) ^
gateway8 S8 e ?) `, L- a! L+ z
. [4 c1 ?2 ]' R' a4 Y& I1 v; [5 f
; R! A+ o5 S" x) j- R6 ?, N
5 [) B; u1 @2 n t/ k+ Z) Qint UF_CFI_ask_file_exist
$ P9 P g5 G4 E _ z(% e7 x4 O) }7 Q7 B. k* t
const char * file_spec,
5 T+ D1 I% W2 A3 [" iint * status
; N3 [8 E `6 |" x3 w! a( o8 u/ a/ C6 G1 c
)0 n, q0 s) w+ w
: f! d1 c% y d0 b3 G+ \# D: T
| const char * | file_spec | Input | The file to check | | int * | status | Output | File existence status.
( b8 ]+ ^$ Z# U& P0 - file exists' _/ c: _' v( o
1 - file does not exist$ k+ D/ u2 [) L8 Z8 K- H4 E0 L1 b
' d- q' b" n U( l. h1 V
| , r- T* P2 S' R( |
|
|