查看: 1753|回复: 0

[资料] 使用Ufun的CFI函数直接判断文件夹和文件等操作

[复制链接]

2477

主题

1280

回帖

8万

积分

管理员

PLM之家站长

积分
82265
QQ
发表于 2019-10-9 08:31:23 | 显示全部楼层 |阅读模式

请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!

您需要 登录 才可以下载或查看,没有账号?注册

×
$ V( s& |8 ?' ]2 O7 j* `: f3 T
$ \' b- t' F' ^+ W3 L4 R: n' b
在进行相关文件和文件路径判断时候,ufun提供了内置的方法。
7 ?# }* b3 U" j8 f! f( u* _; L6 _UC4560 通过设置第二个 参数为 100 可以判断文件夹,通过设置 为 0 可以查找文件。
2 }; h4 J# S, Y$ u  J  o5 w: E6 _+ B3 a( R- }+ x% A/ [& O) U
* Y+ x) {" q5 V" a' d

3 {# `5 L" `( u2 t/ u( G' z& t
5 `+ z1 K) f8 `$ u5 T8 K" ~) Muc4560 (view source)3 H" J7 j8 Q9 \* Z
! L3 r! P' X$ `# k' l' k/ t+ B
Defined in: uf_cfi.h
( N" x0 K+ K# }* f0 z 9 |& c" |! W# \% e3 l
* Y/ k* i7 R: x9 M& `' R% _* f, I3 w
Overview- o4 E0 n4 Q3 d/ x8 V4 V

2 O2 M% W8 R. n) Z' qChecks whether the specified file of the given type exists.. `, X4 Q* P) }$ R1 a$ x( Z0 ~

$ y, h* i; \' I: fNOTE: Mixed or upper case file names may not be found if the/ Q% H- C: h" O0 D% ~* W
environment variable UGII_OPTION = LOWER is set.. s/ d3 X5 P& X  ?3 O8 f
* m# b: D9 ]) u1 R4 Q9 H  t0 p
Passing an ftype of 0 will look for a file but does not work for a directory.$ [  A% m* S$ v- Y) y1 U' B  v0 L, h2 J" U
To check for a directory the ftype must be set to 100.
" m4 E$ ?; u- o7 y4 v2 {
( I9 ~# b! M9 c" o
7 ?, D( }3 Y# o  _9 F9 z
Return+ J8 k7 c; T* h6 |

2 z8 G  m4 A3 O  @4 r2 U* FReturn code:  @) ]0 j/ r, }0 Q8 }# z8 l- G* q0 _
< 0 = Error
+ H! ?) V- W6 A+ k; F. B$ z= 0 = File Exists, q# A  t, o/ `
= 1 = File Does Not Exist0 L1 P( r4 o! h; P9 q

1 i4 i5 j3 [( G4 T9 m

) @: A% u7 M; u( a( nEnvironment
% m1 m0 Z1 \; s

, c/ d4 _1 i6 G; R' W, H1 BInternal and External
: }% Z3 v) i4 A6 F! U( N7 Z
! D) S2 v  L- i
* g- N! r6 W) n9 p; Y2 u9 j
See Also
0 ~, _  V0 x  h7 h0 G% B

: W  Q* t# n+ t9 K# I3 LFor description of file types see table
7 U2 N" W# L6 x# a$ E) ^9 u: U
, |2 L3 z, t$ ~- X/ u" R+ g: F$ y
8 [; P* a! n4 h0 o. _5 d7 I5 J
Required License(s)
. [0 ^; C7 {, {, y5 k& x# j

$ V0 n2 j9 G1 cgateway
. a7 M% i% S. l# t6 Q3 F. P
' R$ G. B+ V9 |7 H6 W9 l
2 e' L& v; ~9 |( O' Q6 ?" @5 [: N

. m2 j; T' @7 D% r; Uint uc45604 y$ _8 J$ E0 `1 z( Z1 V
(
5 p9 A2 r3 w# ]/ k3 T# d3 fconst char * fspec,' D. E  k% @9 \$ |9 C# B
int ftype0 }: m9 R( y" Y3 C3 U  X- `

! W* F% q: y. k+ D& t& f)6 w7 c9 Y, Q! s, b+ [; g. C  @
- j  `9 R+ ~: t$ V
const char *fspecInputFile to check
intftypeInputFile type
& R" Y8 |9 P# I, ~0 will check for files
' Q1 Z: Z3 J* r) N% P. m$ g100 will check for directories
* p: m8 s; q5 X( ]0 P, c# ^, _

! {( y! J4 n2 Y& a1 A& D
8 J$ g/ P5 O4 E% G  V, V查找文件也可以通过UF_CFI_ask_file_exist* `; ^4 \5 L2 f# \, W+ l

' B! y5 L* E: ?# W/ Y2 v2 d" _UF_CFI_ask_file_exist (view source)
1 F. u# d: x( I& G( A ! u% g1 n. x6 U
Defined in: uf_cfi.h
4 U# L# z; x4 @' C2 X9 g# C
; i  g6 @- C& H; {
7 Y  `2 ^6 @3 C6 T7 J! J" p& a
Overview
8 g6 |% F7 ~2 W- r) B  H4 |7 o

7 c  S6 m: `; J1 e9 N! o- gTest if a file exists.
/ n9 c: G# Q0 R6 ?0 ~, v# {" \1 u3 A8 a3 g1 W$ ]1 }2 r- [
Note: This function only works with files - not directories. To check if a
( g2 b: A8 x- e' M2 K$ x3 c5 j9 L% X& kdirectory exists use uc4560 and pass a file type of 100.
7 q1 e: {9 u' |' f9 G- R/ j; ?" }& J! C+ s9 r

2 Z4 g" M; V( \4 M( P. ^) dReturn
: V- R2 D* f3 f
9 W! \( F% i# k/ W2 |& Z
0 - No error
; l. c$ ~$ n$ D: B/ L7 G& T( ZOtherwise - Error Code. C& J. R5 U: k$ u* R# c
% s. t  V! j4 H: _

& i3 O9 D; s3 ~3 v! bEnvironment
1 I1 c5 m4 `; z" D" j+ v

5 @5 ^( _/ }6 O# N1 P) I5 D3 z; AInternal and External
7 E7 Y" b; E1 ^7 @1 @2 _3 c' {$ Q6 s4 J( q
( p$ v  I- T) j
History0 I, C: Q5 Z2 W% d: I" x1 K6 P
( E  n* I2 l) m' U4 f
Originally released in V16.0: l/ P: h' v' ]; X* e6 q

; O3 h: C* D9 Z

8 T, |" {- ]+ P- l9 j# u4 Z* MRequired License(s)
- q7 A8 w' H3 Q: I

. ?# l, t1 A+ v' Q9 Qgateway
" `0 p6 S7 Z( V6 N: k* k2 M
5 L2 h4 m2 W% V- Z
* v$ Y) }1 _/ ~$ k# j

. M0 o$ C4 u6 ]int UF_CFI_ask_file_exist3 E% d8 Z. u; ?
($ m$ I5 ~6 P* Q- [9 Y9 M) Z
const char * file_spec,! B4 v3 Z3 n! U8 ~( F7 f+ _
int * status
, o# Q5 n. y! {+ S- X7 l% O! n, Y4 H! l
), B: {* t7 ~* b. r% H
6 x  \, V/ C' n3 W( r
const char *file_specInputThe file to check
int *statusOutputFile existence status.: q* K" x7 Z4 C/ V2 x9 o
0 - file exists
. ^8 r4 M& i. e1 - file does not exist
: \; T. d1 o1 |2 k7 T
2 U5 H5 M" _, n9 O# T8 e) z! T

2 P" ^% P) |3 }5 G" \
上海点团信息科技有限公司,承接UG NX,CATIA,CREO,Solidworks 等CAx软件,Teamcenter,3D Experience等PLM软件,工业4.0数字化软件的实施\二次开发\培训相关业务,详情QQ 939801026 Tel 18301858168 网址 doTeam.tech
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

在本版发帖
关注公众号
QQ客服返回顶部