|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
( o9 F: l- u+ \0 M% m3 P- _9 F, r9 j; R# F0 }3 p
在进行相关文件和文件路径判断时候,ufun提供了内置的方法。
B2 o) e4 P- Y9 F& S/ n2 j8 j4 uUC4560 通过设置第二个 参数为 100 可以判断文件夹,通过设置 为 0 可以查找文件。
6 `$ y/ e2 B$ z7 B b' ~6 C' E6 q
% x6 K% H9 P. Q5 t
) h# T: k; p( n6 B
, H# O& {1 ]% R O8 w% v
uc4560 (view source)
4 M: @& o) S$ \) }
7 m* L. A* I* A/ W2 vDefined in: uf_cfi.h( h% S$ z/ g$ C% S
" g3 v, ~, o1 h5 |# t w
& } T0 H& h4 I4 c, d- }4 kOverview: F1 M2 Y( y. T0 Q8 F5 [1 Q# [" b, b9 J
& n( Z0 c- d8 Y! ` l" [ d3 ?4 qChecks whether the specified file of the given type exists.
! \0 m8 g3 J- z6 q; \0 [
1 a, c& U! d/ k( x2 FNOTE: Mixed or upper case file names may not be found if the5 r9 N$ V1 R) U& t$ a
environment variable UGII_OPTION = LOWER is set.$ j) c" q! ~* z1 J, H4 w
7 H. q( _% e+ d
Passing an ftype of 0 will look for a file but does not work for a directory.
: X/ O3 W% x8 l/ @2 CTo check for a directory the ftype must be set to 100.
* x- i. O2 p" N! R7 q
% b6 i2 F+ x) f3 h4 h4 s; b, ~0 V5 V/ W% d$ \
Return# d- z/ G0 d; x6 ~! k7 i
. o9 b0 X, O3 Z# Y3 K5 d
Return code:
' P9 @3 l$ \1 [) X+ r# n$ O2 `< 0 = Error
0 I- f7 f2 _2 u! Q8 y! b= 0 = File Exists. U4 P* R, ^: V8 U Y* A& r! u: |
= 1 = File Does Not Exist7 D+ m) O5 G( l
/ p6 L6 [( y+ d# y3 W5 b0 k6 N6 T% ?5 ?
Environment6 M' ?4 ~3 h$ C) W. K
, q$ f6 L. x, d
Internal and External( p# p* {8 @% m3 z
: X) I/ V) w. p% _
6 P' G7 G+ Z8 H3 [" OSee Also
! B8 E/ S: r5 R6 p5 z& B& F; Y' O2 s
For description of file types see table
; P5 m9 v1 j- z# z! F * U& |) ~1 [2 h% u
4 Z$ q5 a) h# ~' TRequired License(s)1 R- Y: a, u' m
: U$ Q) ^1 \2 u& ^8 egateway$ W9 L& @+ n3 R3 b
7 r$ ?3 t6 t o2 t6 j, V% e/ {& q2 |
1 _1 |3 F" ^% D3 n) |( o y) v" G
5 y, e1 S' \2 d" }8 R3 ]! O9 @int uc4560
, N7 _1 ~* t- l: H# E' s! d" ]% P% q(& e& T0 h9 l3 v/ [& p* q# a/ _/ n! ?7 e
const char * fspec,
5 ~- T; { I4 ~int ftype5 q$ Y8 u+ w& d2 H6 h% Z
2 `- E, g2 w# b3 I) ]2 F- k
)
0 ?$ |+ G# u- F1 F: o2 J) d( F; i6 C& {
const char * | fspec | Input | File to check | int | ftype | Input | File type
5 d6 ]: f) G' g0 will check for files- V& t/ f6 f% j( ^% u
100 will check for directories | : C. e3 v, }+ c# |3 V( ?
5 M, e9 V& c$ w9 O; E7 b5 M: ?" f! I" Q
查找文件也可以通过UF_CFI_ask_file_exist
3 D1 [; B3 ]+ D# z+ F2 v8 }- G2 l; l" S
1 n$ W2 W" O! e y5 v" n& S8 D6 NUF_CFI_ask_file_exist (view source)
5 [, r+ q5 m% ? $ M; U& V9 t) n* O4 @
Defined in: uf_cfi.h! ?$ C% Z1 c( d4 \, p
1 `2 N- y t/ a# |7 P0 B1 ?
$ n1 d7 R: e% H/ ROverview' H$ S' S5 q' P( g- ?) E
3 i$ w& m; I$ e: e$ r/ Q0 U+ h6 u. N
Test if a file exists.5 X' h, L) ?7 f7 |+ M' A9 _& w
; B. L4 |! @% r7 z7 M$ aNote: This function only works with files - not directories. To check if a% W1 Y2 p- w& s4 |& B- }+ h
directory exists use uc4560 and pass a file type of 100.4 c& J0 Q( M) j/ z C
8 v4 Y4 c2 o+ s5 Y( u& Q
: y* z: R8 F _" v: A" [" NReturn
9 a9 j* f: n) t; k4 I& L' W& u+ ` i' V9 j
0 - No error3 t7 Y: q1 K$ ^; W
Otherwise - Error Code
; J+ K4 Y, F( i! I, \5 ^ d" H
# N0 q0 b" e7 l( Q* I m$ i3 M
4 y8 v1 f# I1 |) E" B# ?+ ~Environment
* s5 x g& ~" {
/ R1 n% a4 z% z6 z) b; Y6 y( jInternal and External% o# l0 Q/ e* L& n
" ~3 ^( E4 s5 o! D7 M
. j( _. p" X" m6 C% G1 gHistory. z! h' e4 d' Y6 D" s
& [2 B5 m& S5 u! I1 UOriginally released in V16.0
6 G8 I( C" G8 I: ^4 {4 d
9 z) K. e) O* B
" x" I7 r1 S2 n ORequired License(s)
* a* A2 s8 i# P
8 M9 }3 I( _8 G3 bgateway& s5 J! f. v1 K% N; C
t9 X) c4 \5 ?) |
# j! |' |8 s* j6 v * \ x. w2 Q; w
int UF_CFI_ask_file_exist
5 F5 `; L, y. x% o. e- k# T(
8 x# C# ]" L5 `const char * file_spec, e1 V7 x, }# a* v
int * status) M( n# D$ Y/ q& Y" R; Y
: d; |3 u3 y7 ?$ v5 M) M6 m3 Q& Z
)& c7 w! m) D$ x7 ?1 a8 k6 x1 i
& m1 F8 |" ^5 L @ bconst char * | file_spec | Input | The file to check | int * | status | Output | File existence status.8 m' M* B$ e) O; [4 u/ w
0 - file exists
- E! b; i, d: F* i% {1 - file does not exist
$ @& L( L6 V6 N7 I1 y" A6 N0 N
( B0 P" S: j0 M9 H | + I' v# T# S' ]7 b- F" s, |9 p
|
|