PLM之家PLMHome-国产软件践行者

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

[复制链接]

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

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

admin 楼主

2019-10-9 08:31:23

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

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

x
# K5 @4 k) F. E" G$ |
. O) @1 y4 l) e
在进行相关文件和文件路径判断时候,ufun提供了内置的方法。
* ?  y$ F0 }# k7 g+ gUC4560 通过设置第二个 参数为 100 可以判断文件夹,通过设置 为 0 可以查找文件。
# A/ i" p( Y$ o; F9 \1 X  o8 _/ w& W& e$ R& q7 w. q

( t" X2 t% V" N8 c. Y
) K/ S) w% C( U1 O2 @0 V0 Z+ y5 t  j& a4 d4 z9 O- h9 i' S* f
uc4560 (view source)* J- m% p: j  t( o. W9 a

3 j% ?; i# h# G6 FDefined in: uf_cfi.h
6 Y6 A0 s3 H# i+ ^9 {8 m 8 |, E) T, f9 J4 B

0 m) d$ v/ h$ {, g6 bOverview( `) S$ _$ ]7 A  s; ^) Y8 j
! U, A5 H3 V1 G7 N& \
Checks whether the specified file of the given type exists.
( Q& X( h% C. H! \% P; Q+ q7 I
! R' c/ L' t. k& e, \# GNOTE: Mixed or upper case file names may not be found if the
1 ]8 M$ o) i4 ^# b" ?5 k+ b5 @& Genvironment variable UGII_OPTION = LOWER is set.6 R9 I- n$ C3 Q, Z

/ B4 N2 O* Q/ L0 y7 ZPassing an ftype of 0 will look for a file but does not work for a directory.
' w/ E; z/ i# h! F1 KTo check for a directory the ftype must be set to 100." B+ w/ c* u2 ^4 p- A9 c' U- O
4 J  r" N! z) q- u( r* i" x

) H" a* P3 y2 K( \Return
' S: D% q3 l: h  X- `8 k4 S
, L) O0 w  d/ z8 f
Return code:
$ J4 P% o4 x! v0 ~% g< 0 = Error3 ^& Y. x( @  V3 v" U3 ]6 s
= 0 = File Exists' o  B- v" c" U& Y5 p
= 1 = File Does Not Exist
; _3 K6 L2 l$ o0 d! l- L  V4 S* c4 {6 ]; _6 Q% x; C: b
& S3 T3 a( }, X% k) e! }9 J- M' G
Environment+ b& N* o! C5 D: i# Z
$ L/ L. B1 u; s0 P6 e0 A3 D# ~
Internal and External
5 c: D! @5 Z7 p5 R+ P
8 X5 }- \) E5 p6 w4 F2 V

9 a( D9 g7 J7 @See Also8 [1 \) ?" ?+ f' v6 n
/ t8 k# A8 F4 `/ X/ x7 Y. m. J0 }( \
For description of file types see table
) z# `1 l4 E2 A+ Y0 g1 s) u- Z$ {
9 k1 \0 |/ x$ R$ d

6 K) p( s" e# a7 p: vRequired License(s)
0 V% B) s, O/ W4 k8 `, Q5 Y2 b9 e4 A# E
: |! l9 w0 y- f8 T1 i6 N/ p
gateway! |/ L# Y. j4 I/ \5 P

( d1 }2 V  ~$ H  ?- [( o1 M$ L0 u1 M) e, m* r( |
8 |5 E- \9 g: G2 B" p
int uc4560
3 F8 B2 I: g2 x9 [- \# [- }5 x  e! |(
+ Y5 [% Z- }- {" Aconst char * fspec,
. Q: Y( |. e0 e4 Oint ftype; S8 u2 i# N& {+ U6 p: s5 g4 c
+ |$ E5 K5 k  a# }( e6 G2 u
)  s/ n% y! O' Z5 p

- X: o0 W5 R. g( t! h2 [! z
const char *fspecInputFile to check
intftypeInputFile type
8 q3 e# d" q! e$ H0 will check for files4 s$ X: W1 [7 s3 ~3 R: x( q: l, C# y
100 will check for directories

' z0 B$ U2 M5 e$ {/ O, Y  s
( g4 |5 d5 p# p- _
( q9 O% j$ F; O. w, Z- p5 x0 w查找文件也可以通过UF_CFI_ask_file_exist
1 x0 \+ H3 x# g
( i1 B, F/ f2 k; p8 \! LUF_CFI_ask_file_exist (view source)
: E# W5 G8 B, [& G+ l* X7 V# G$ K 4 v# [" K$ K# L
Defined in: uf_cfi.h
, ?9 C1 _2 s1 B7 d, U
2 v/ P: s: v: _3 w
! Q; {, B: N2 _5 {
Overview8 [8 K; \5 @8 j

* O/ a2 m4 w- [( RTest if a file exists.. s  M3 D9 d5 e, w: }6 w& [! s

6 `+ J$ ?) }1 s7 X2 vNote: This function only works with files - not directories. To check if a
+ I2 V; q3 C, Q0 Y7 E2 G$ ^directory exists use uc4560 and pass a file type of 100.. F5 R1 O7 i, P' f

% D9 G# k) s2 n

! x6 ^* _) s0 |& {' WReturn9 l0 E2 d! b: D7 [- p; X% N

2 r9 C. n5 j6 t0 - No error& c1 l. f* R# n0 O* y! k
Otherwise - Error Code
# d; b0 T# A. Y; L! Y0 |  x
, U( g8 G0 q3 r8 K/ @  k- }
9 C9 ?5 w% u  j# d2 l) B5 n4 P
Environment5 n# j! K$ N6 [. d  Z. A6 U
4 d' |9 }0 x! Y
Internal and External! W- r5 i: t; i  J1 F/ R
( x6 X( `+ R: H# _
6 i; V- M- _, p) U$ I5 l8 S* k
History1 I4 d; I9 ~% O  g4 l  P# l
3 L3 Z) c. I' j7 D
Originally released in V16.0/ H: k) t% @, p4 S5 c/ S* K& s

+ _& O$ B9 s- b0 e0 s: m

% f0 P; o! h7 k9 Y9 MRequired License(s)( _& j% r8 y( v
( X# v& b! R1 F1 h* q# i1 m1 Z2 k4 F3 i
gateway: r- ]# Z7 C8 D4 E0 `+ Z. S
! ~7 v( \9 m! \$ r

+ o/ J  P1 R- S; H; m
3 y( \  L, b6 {  Mint UF_CFI_ask_file_exist
& i$ g0 g6 A( l/ _# U0 {(
' W$ d+ P* L; l1 U- f* f* y9 qconst char * file_spec,. f. k4 N* i0 c
int * status/ \2 O. _- I8 A% e% f( f4 V
" p0 Q; Q: @5 I$ [
)8 q6 Z+ p/ Z% Z: F! d: ?7 m7 F
  _! I. \: @4 Y0 Q, P" h- I4 a! W7 H
const char *file_specInputThe file to check
int *statusOutputFile existence status.0 J. A! W1 ~$ o7 p4 Y7 S
0 - file exists8 t% o8 j) J- M$ }" g! u
1 - file does not exist
# E4 C8 p9 F/ l8 k
8 G& t+ w. I2 f! s$ a- ?3 O7 z

. o/ V; t4 X0 P0 p& R
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了