PLM之家PLMHome-工业软件践行者

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

[复制链接]

2019-10-9 08:31:23 1421 0

admin 发表于 2019-10-9 08:31:23 |阅读模式

admin 楼主

2019-10-9 08:31:23

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

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

x

* G; m9 I# ~1 ~6 Z# Y3 s: @1 {& ?) m' W) D9 F7 M& g' m9 \% s
在进行相关文件和文件路径判断时候,ufun提供了内置的方法。" j' x. |, H( ?+ v2 m) q
UC4560 通过设置第二个 参数为 100 可以判断文件夹,通过设置 为 0 可以查找文件。: y! X0 d$ G( B. y) |, A
  m' o4 U# ^( u' U6 m6 S
, @4 D# i- O' @* Z" [8 k
1 A+ z/ ]) ^9 U
' V4 g" r, o" z# l6 |! t
uc4560 (view source)9 z/ e! o- X. ?7 n* {
' n% ?0 T& `8 i* F
Defined in: uf_cfi.h
0 A' n& P1 R/ g& ?4 V" A
1 g) S/ Y, I5 n3 A% J7 \' |5 p5 X

# b$ v" r0 {9 i1 d* }1 @, ZOverview
. L6 h8 D9 a% L/ U

9 Q6 L+ Q  q( \1 e2 U- NChecks whether the specified file of the given type exists.% V2 X" S% T4 _

2 [. X; n* F& Y/ KNOTE: Mixed or upper case file names may not be found if the$ O! {3 E; K9 Z9 ]
environment variable UGII_OPTION = LOWER is set.
3 v1 W/ V5 p: Y: l% M, M& Z7 O6 k" |* E5 I
Passing an ftype of 0 will look for a file but does not work for a directory.$ ~1 |1 `( U& i+ F
To check for a directory the ftype must be set to 100.
1 A8 D( p; U* o$ `4 Q9 ?# m
# {* g$ Y8 ^1 W- o& a

! i: |9 q: w3 v- VReturn
0 U/ o# X3 `3 G: ?6 T& d- @2 p

4 g& ]5 v5 H# M) jReturn code:# r( R% w1 k1 K2 [! E
< 0 = Error
# s6 y9 s$ V  j- c) \, U+ c= 0 = File Exists
7 f5 X% p' @1 I$ o' c= 1 = File Does Not Exist) x' i0 _0 f: X6 ~& ^5 _) i& d
% g5 `) y' o# D: O; k" Q

+ X5 i# D' Z( k" UEnvironment
. d; C7 P1 A& y9 e& P* o
. v, r( s/ s1 ^8 Q+ |
Internal and External
1 Z0 u9 T% I- J9 ?7 q  p
$ D4 I8 o0 V6 O

# y  k! B! Q8 ~+ [' d( m3 MSee Also$ A7 I( V1 E# n1 s5 D3 E
7 x: e0 z7 o4 P" }. \# c- e% u; C
For description of file types see table! Y0 Q  N* U" A  C% |5 d7 H+ ^
" M" Z3 Q, e6 ?6 o

/ d0 U0 X' c3 ^- eRequired License(s)+ \1 P7 h; F6 D, ~8 v: O

& ], f1 t. h' q- Vgateway* N5 F8 q4 o" ]- d9 _  J

! v! T& L4 X# x$ f; S8 e% M4 }2 @( H# w
% `5 ]* I; l. Q( b: g9 e8 P. W" L / a# r9 F7 ]6 b: u2 J3 M& E5 ~9 H
int uc4560. t, s) h% b6 Y7 E& {" y. Q$ H
(
# X7 c. b' y" x; Yconst char * fspec,$ q6 `& x1 v1 E+ v% @
int ftype
* s3 e! y9 `$ h/ A) ^- @& @( B9 a9 z- I! z4 c; g5 _
)
$ m! l% i3 i9 y" v. Q
1 L5 l' W( N2 h
const char *fspecInputFile to check
intftypeInputFile type
( l  |/ U- b: s" n3 v( f" k5 r) }0 will check for files/ Q# {7 {) g9 U' M; Y" V, o8 `
100 will check for directories

6 ^9 A0 ^# x4 }/ I4 O! \6 I; }
/ i, P; S! G9 j! x
8 q! k% c2 q; i' s0 _查找文件也可以通过UF_CFI_ask_file_exist
. r- Y/ i4 M* ?; H4 W0 R4 k6 F' Y; n. g: q- f" G
UF_CFI_ask_file_exist (view source)3 p/ W; n! y9 N2 ~+ y
6 W0 M5 b1 t/ P/ ~! t$ J4 k2 P
Defined in: uf_cfi.h
" F1 T) V7 n7 G- | 3 s3 J* w: a; r' E8 X* [

2 S# k- P7 ?# E* x6 D% \Overview
' n& P( Y0 s2 |" p
+ b. X' ?4 a. L- A) v$ }
Test if a file exists.
' I, p$ E6 j8 O" |8 e; N5 Y- @* [4 e/ p
Note: This function only works with files - not directories. To check if a
9 o; x" N! [% F, c* z8 z' V$ hdirectory exists use uc4560 and pass a file type of 100./ Z( Y  Y9 X+ o. p6 l2 \6 Y. E4 p
. E. @, X4 y( |& k
6 ^" U6 l0 k1 [  y% B3 R
Return, A1 R" T, r. u% S3 Z! K5 }

" [9 ]4 W; ]$ k# s9 U( T. l0 - No error
  I5 o% Q/ l. l# i1 E8 J9 QOtherwise - Error Code
4 _/ O8 x) i& g- m+ ^1 q2 s
, D$ m3 z' @' g3 }; t* d
" _9 c8 Q. ~2 f2 t7 h
Environment8 o, C% C+ A. l* c8 d  o+ a3 Z3 ]
- k! k1 @3 F: h+ s
Internal and External
% A5 O' h; y# ^3 f5 V- E
( O3 g5 O. q! h+ q  \/ k

6 F: p1 }# B6 e- k5 @. f6 t4 W& J2 B0 VHistory
9 f' w7 v. ?" k3 _0 u; J

3 {3 V+ `& k; G' c# z7 ^Originally released in V16.0
3 y5 U- D9 S5 V9 w% L0 d1 o& b 6 @( I* Q& J; {2 R$ }- @3 P$ n: v

7 a  Q- f0 w$ N7 HRequired License(s)3 f+ @! F4 g# \6 z

) n$ v! U. j" ]7 \2 ngateway
$ O$ L1 v) _, G) j

3 r; B) _  k: X  M4 _
. Z1 ^( ~7 p* Q6 c* X2 a - z9 x7 C! K4 S/ C# r
int UF_CFI_ask_file_exist
: l  Q: _4 a& v(2 y  j. j8 b7 S% G) m2 @" C
const char * file_spec,, T2 g: r; @' P1 t8 u
int * status0 L4 n+ r" F2 V% D1 j' {: w
) E) t) [9 l& s) W0 p- A
)
! H0 `+ P' v2 F9 w+ e

- o: ^4 [# j( e: m
const char *file_specInputThe file to check
int *statusOutputFile existence status.. T' q. `8 K0 R+ j# D* `
0 - file exists) S+ Y- G* b, o4 Y8 x+ Y; P* F
1 - file does not exist/ ?& A/ z' ?, f/ B

0 S  M' C0 l5 b/ G7 T, w8 S" C
. o7 N3 v1 _' v; E  s- m! @
上海点团信息科技有限公司,承接UG NX,CATIA,CREO,Solidworks 等CAx软件,Teamcenter,3D Experience等PLM软件,工业4.0数字化软件的实施\二次开发\培训相关业务,详情QQ 939801026 Tel 18301858168 网址 doTeam.tech
回复

使用道具 举报

发表回复

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

返回列表 本版积分规则

  • 发布新帖

  • 在线客服

  • 微信

  • 客户端

  • 返回顶部

  • x
    温馨提示

    本网站(plmhome.com)为PLM之家工业软件学习官网站

    展示的视频材料全部免费,需要高清和特殊技术支持请联系 QQ: 939801026

    PLM之家NX CAM二次开发专题模块培训报名开始啦

    我知道了