|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
' w. P: i7 H+ p/ f1 k* m; k" L! O: ?5 C+ m2 H1 b
在进行相关文件和文件路径判断时候,ufun提供了内置的方法。) M. h3 L) K( k" w( C# o: g
UC4560 通过设置第二个 参数为 100 可以判断文件夹,通过设置 为 0 可以查找文件。 G x, X7 ^$ c% b8 A1 g y2 p$ N: t
& q, J: I( d4 }/ u# B, o
" o/ A$ m. W% @: ~. ~( ~0 P
% q4 l& t- t7 b
" d; u8 x4 S, \5 c* ~
uc4560 (view source)' | g, E; E8 x
$ p" Z: a9 {9 o% L' }! V' b! k
Defined in: uf_cfi.h
. [: I. m2 x; S# u P3 b' d+ M* q
2 P' u9 e! \, R @; h
Overview- \. O6 E' H) W2 Z# g& J- K
* _7 b* [% S1 T" u
Checks whether the specified file of the given type exists.
1 K# W. v! p8 i: C& u# j
+ y1 H% P6 _: \9 _( QNOTE: Mixed or upper case file names may not be found if the. \+ l8 z2 L! z
environment variable UGII_OPTION = LOWER is set.% V X, ^; ]! K/ }) r
1 u: d9 ~# `: W$ pPassing an ftype of 0 will look for a file but does not work for a directory.) v0 Y6 @- e! g
To check for a directory the ftype must be set to 100.
3 Q! U1 u$ A' F- N' Z8 F3 a8 R1 `$ T* B0 F
/ H+ h3 ~# J" @0 V! W) z& g* GReturn
! n; E7 p# O$ K/ R* P" N9 ~/ t h2 X( \ ^$ h
Return code:
- v$ s" I& W( M( K, [( C< 0 = Error
( {: A8 G j4 p1 M5 C= 0 = File Exists
; p$ ~* A9 i1 j: \9 `= 1 = File Does Not Exist' q, `. g( E/ l4 u: |
8 h" f$ ~2 J# m8 w7 I+ S3 l5 @% J
Environment
! S9 X. N& {7 W, J. U f+ ]0 e: G9 G* `$ R, {2 Q+ B: M
Internal and External2 ?( ~; R2 C' p) C! {5 r
5 \/ ]! M" P6 ^( ]) E* [9 H- b
See Also
# l, ^" |9 Y# T2 S
V( V6 N; g( A/ T5 X, G/ hFor description of file types see table8 F8 o! Y) N4 |4 D) f, ~* \
7 E# C/ I( u# d3 I0 m, H3 W4 \6 T
: k# p# m0 I1 j2 YRequired License(s)* k2 I/ N3 \8 Q
! |. E# K) V5 Z* F2 I% X2 Kgateway( i$ m9 S5 v! D5 g3 k3 L1 c
1 Z) t6 W$ k5 g5 F
6 l8 r5 e1 A3 q. Z0 v2 S, b
/ P% s2 R4 b8 W& W2 G5 gint uc4560% g$ M+ l( v2 Q/ N0 k. q
(
0 ]' S6 P; k! p1 P- aconst char * fspec,; R' [; J) } ~4 C/ J
int ftype
+ t7 J& p6 E( M9 p/ }6 k+ b; I; R$ X5 ^& p$ P# @" z+ O
)2 |& j# K( `4 j( }6 }6 |
. K! N" J: T2 V# c3 c| const char * | fspec | Input | File to check | | int | ftype | Input | File type
! f# X1 \5 G% A0 will check for files
- X! V/ O9 X, [" Q; }100 will check for directories |
& A; f; J2 t# o/ X9 H
" T& r3 |1 _4 l+ N8 Y8 B9 D
- |' b: i$ z* v% n; X查找文件也可以通过UF_CFI_ask_file_exist$ \- N2 w' D9 k8 L# V
. {4 X1 b0 A6 R9 ^* g
UF_CFI_ask_file_exist (view source), j8 ^ J: @2 x0 p# G& j
2 C* z& r" m! q6 F5 ~. O J7 h7 F
Defined in: uf_cfi.h
+ V9 [" G/ i$ N7 t, J. {
2 I" B9 ?' R3 e, t9 M4 ~. o( Z( H+ l) t9 { ~$ ~8 l/ t
Overview% r+ j0 C6 v1 Q
8 k' ?3 H2 L/ x7 o! N! JTest if a file exists.( C3 L( O6 ]7 W( k: J( `
' W7 ?. A) y3 a7 k0 E! r+ N% a
Note: This function only works with files - not directories. To check if a. z. R ^5 o" h# k3 `
directory exists use uc4560 and pass a file type of 100./ o% \; I7 }: c! j! w( ~) W
) f1 `1 @- r# K
0 }8 ^1 v4 g, N. ? b/ ~1 f/ GReturn6 t/ H+ q/ i6 t! I
+ w5 {6 f' ~9 P# z; l0 - No error4 Z+ ]/ u" G. Y
Otherwise - Error Code4 x9 e+ D! W ]
5 [) Q1 T8 t; e7 V, }# V3 T
+ S& Y2 H( M/ s7 ^" zEnvironment3 Z" t; j: a$ r9 {9 c" ^8 U4 [
; L& M- K& ?' d' e2 u$ [' K
Internal and External2 S$ u) t8 k& [( S" b/ w* {9 r% [8 i. G
3 h1 P2 P! X: ?3 S. @6 U2 j- |* _1 b4 C5 _! z7 _
History
* p6 k2 n' x9 b! I! G; @5 L- u/ d6 b# K4 A" W8 A
Originally released in V16.0
! o* x6 c t+ a1 S' Q2 l ' X' X8 F( W" z0 I2 z
: Z7 o8 v' x1 _% K* JRequired License(s)
( G5 B0 k# G, V0 D
1 B# r( ]# a5 W. k8 W5 ygateway
8 N9 V; r; n$ K5 _6 ?, i) V3 E
4 F" K0 X, k* [% R8 G
3 y* @6 V8 H; q2 S ' @) m; O2 u0 A+ D6 A# M1 X
int UF_CFI_ask_file_exist
: _! Q! v& y3 \(9 H* j" s% z. a: n" x
const char * file_spec,
8 M# ^3 j. q) c. Rint * status! u$ V+ Z8 x |1 K
' k2 b2 L5 t" f: o) ^' B% b1 G)7 _3 c. S; {, z' Y
# p5 [3 l/ x! H| const char * | file_spec | Input | The file to check | | int * | status | Output | File existence status.
( X' f4 K! c( i3 G8 S4 ~0 - file exists
& \; V/ n" V& X1 - file does not exist' G# _* r+ g+ m# g4 j* k
: }( v, C5 ?; k E' ` |
, r7 H4 V7 d6 N6 k0 G |
|