PLM之家PLMHome-工业软件与AI结合践行者

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

[复制链接]

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

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

admin 楼主

2019-10-9 08:31:23

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

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

x
; a9 R8 u5 D: k! M

/ v8 b7 t, t& f* e- E3 C. y) ^在进行相关文件和文件路径判断时候,ufun提供了内置的方法。! W. a* B: k4 y6 Q& r: h1 h  z
UC4560 通过设置第二个 参数为 100 可以判断文件夹,通过设置 为 0 可以查找文件。! S; o# c$ ^# i; }' S5 a1 d

. p/ |1 F4 O% Y- U
1 y7 C) U9 j' \4 Z
/ ]3 }+ g. H: B) N( {5 j
. P3 m% P$ h, p! o. puc4560 (view source)6 Q5 }5 _! j3 A/ a% ]: E5 @

/ l7 X; U6 W5 LDefined in: uf_cfi.h
8 i( ^4 t, M: ?2 X2 \ 5 i: L' W8 b7 D' m! M: s, Z
# r6 m% y7 |9 n# }
Overview
$ t+ o  A* D$ h& n5 A0 T, i, l

0 R, _5 i/ o5 S; F, QChecks whether the specified file of the given type exists.& I. i1 p+ E$ m2 n& T

. ~8 }1 I3 z, r7 u7 p) LNOTE: Mixed or upper case file names may not be found if the3 {$ l3 N) w1 W3 |% d3 _+ l+ {  X
environment variable UGII_OPTION = LOWER is set.
2 l2 b6 m* b: i& W  s) r; y4 }' b+ e8 M  x* n
Passing an ftype of 0 will look for a file but does not work for a directory.8 t+ R8 A% H0 @1 s$ x! ~8 ?
To check for a directory the ftype must be set to 100.
6 M8 f" ~9 ]% y6 W# E! H) s
6 K1 _( m7 r8 w  T3 @5 j

4 o' t& S5 |9 A7 K  zReturn, y/ B0 F' K* p
& r9 D3 J5 T3 m. [9 E; X7 S
Return code:5 h6 A2 P0 d6 d; r
< 0 = Error% }1 y2 V+ b+ ~, s
= 0 = File Exists
0 W5 r) D! E  d/ B, L( c8 p7 |$ H= 1 = File Does Not Exist
7 y* x9 o% g& i% y% D3 b3 m8 W4 |
2 t" Q- |5 x9 n3 C; d8 v  L

" ]. D' I6 n; t/ k( A; OEnvironment( W7 W) C" d# E5 t; n! Z  K( U5 b+ E8 e- ?

# |8 @% O4 s6 g5 A$ ~Internal and External2 R% C" t5 y! ]% U. Z$ F
* c6 e8 [+ \: e
1 J; O5 w5 e& X' ^
See Also
" J, a, e8 Y' E) P; F
* q5 O! x1 o! }5 r  d. o
For description of file types see table
0 n1 R1 D0 [6 E5 M
# V$ G4 F' ?  I: x# J1 G4 y
  K5 D8 s4 U* Z4 c  F% Z/ Z: X1 P0 ~1 p
Required License(s)
5 C4 b* y( b% {( i4 ?

3 z  k4 \+ U- H% }% M" Ngateway& S+ F3 ?# _$ Z+ P. S6 Q) d

5 k$ d0 q$ x. I1 @, ]$ j4 F8 z% g; T* K* t3 K  Z* `* i
6 L" L( u7 X/ D, _
int uc45600 E  H; J( h: p3 o
(2 E' O/ `* u' u. I( n
const char * fspec,
3 v7 K9 b9 O  Yint ftype
; W! m/ |( q; g& |) m) x, _6 t/ n1 N' u; X! C4 D/ b% H. m3 T3 x
)
+ B8 ~" g$ R) w
: \0 d2 C. D/ K' a3 ~
const char *fspecInputFile to check
intftypeInputFile type
$ S/ N0 v. U) ]6 C7 I" H% ^0 will check for files0 E' U& C, O9 Z1 O
100 will check for directories

9 u  D+ U1 W# H- \, t  i3 N" L& B& J
/ p+ ~8 p1 l) q8 F2 {7 ~, ~4 d
查找文件也可以通过UF_CFI_ask_file_exist
) I: k& g8 n" p7 t2 b5 j' ?3 ?2 l: L7 C) _7 Q8 c( Y) |
UF_CFI_ask_file_exist (view source)
! Z4 S. \- G: v1 T$ ?
0 ]4 J- s/ e  u5 J4 iDefined in: uf_cfi.h
- w: L0 B0 J$ H' X$ P % t( \0 m+ G- x% E: U+ t4 B) T

3 P% B' U# i$ P( D! n; vOverview) x2 _$ g+ D- k* N* e
- T! i% H3 i; y1 O9 _+ n- i- t
Test if a file exists./ m* K: `, \8 W
) S4 ^; h8 N# l6 \& |
Note: This function only works with files - not directories. To check if a
, X/ s& _6 f/ {' U& o5 Gdirectory exists use uc4560 and pass a file type of 100.6 n! @3 l5 L$ j6 a' i% p8 w% T

- j7 R5 f3 \4 G/ B& i

) _5 o% G' P* T+ f/ y5 l4 U: T! `4 YReturn% H4 f' k4 A' @2 }

# C1 u( r9 s& j# C8 t% K0 - No error2 p. q7 n9 k4 q
Otherwise - Error Code
- l/ G' K7 ^2 L. z5 I" |9 p+ l7 Y- _* I9 n, R! o

* K  |* M- p7 G( w& aEnvironment2 N( c% h+ b$ ?- o
* I  N7 L( J  j7 ~- O0 Y- H# h
Internal and External
9 `9 O9 ~4 ~6 V( b3 Y9 c3 j
1 R( z" N. O) x. f" a
7 b3 i/ w" ^' u9 B
History
8 [: @6 _9 Y$ g) f
1 Y( }" `  ^  A' g
Originally released in V16.0
/ h& _" P4 [0 q: s# v( |8 j0 V- l! l ' v; H5 Z- ?* k! ~7 n$ }; m+ `
/ g& X. T) V+ T; d! m- h4 `2 X5 t
Required License(s)) T/ I. b3 i1 E

8 U: j& z0 l% y: I& N- vgateway
3 b8 _' N' C. y
0 R3 e3 T4 e& r* j0 ~! d  g
) G9 K, |& T2 T0 @6 Q
( B( ^! |4 w) E+ c3 F. `5 I
int UF_CFI_ask_file_exist! z9 ^: y/ _- U; o9 E6 U; K8 G
(" m) a' `! ?! a: w5 V
const char * file_spec,! \, {8 q2 z) |+ ^) F* {1 T8 r( l, U" Z
int * status
$ U. I3 w" O( c" b1 t
' @& ?4 }5 K- r: B' q)- I$ b8 _* i5 [8 b+ l5 y* i- m& D) j
. _5 c1 @( K6 X: M0 E# S
const char *file_specInputThe file to check
int *statusOutputFile existence status.- k4 w! R# N$ _2 e/ ]
0 - file exists9 G# F& {* T; f$ H* H, ]; [3 D
1 - file does not exist4 V) \; J/ M5 R3 v, K& u

, h$ K# Y) k! }1 I- r9 ~

4 V. r- U8 {6 X* D! ~7 i
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了