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

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

[复制链接]

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

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

admin 楼主

2019-10-9 08:31:23

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

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

x
" s2 @- A  Q+ h2 Q" d8 E2 H

& X4 n' ]- v: N( x& }在进行相关文件和文件路径判断时候,ufun提供了内置的方法。' D2 s5 X/ k' _2 w+ ?( p' Z
UC4560 通过设置第二个 参数为 100 可以判断文件夹,通过设置 为 0 可以查找文件。
7 c: c5 }+ F( Y- A" M7 v4 F" U6 r
' h9 A, h6 G: b6 K2 `5 [

% l2 W% H# s+ @% `! x
. ~3 O1 h3 A5 s+ w+ K6 D9 guc4560 (view source). D# Y/ k& B, q$ y. d, H9 ^, q7 f

: H2 x1 ]: d4 t- B: gDefined in: uf_cfi.h
* L) K# D$ \4 Z( c! \. O( w& ~
# q/ `% |% o/ P% h
5 T2 D+ ^6 m" N' o
Overview
8 I; D+ H5 g9 g
; D, K1 \2 d: A2 {
Checks whether the specified file of the given type exists.2 V& r4 ^7 |4 T! F

/ d3 A) q/ K8 N( l5 L$ MNOTE: Mixed or upper case file names may not be found if the
, ?, M, \- T. x: {3 V2 J: ~. ^/ }environment variable UGII_OPTION = LOWER is set.
  }3 s; z% l$ l! o; [$ E, g+ W  O: T# s4 W+ U
Passing an ftype of 0 will look for a file but does not work for a directory.
# i5 [" n$ N+ X5 _- y% ATo check for a directory the ftype must be set to 100.
1 k' q" _! S1 V, b
& y6 ]/ Q, ?" e" l* f7 L
+ u, q9 G, G* B; L: W% A: E) v. c( E
Return
! X4 ?" R( v/ q* V$ z3 X  j

, S; p4 z* r) hReturn code:
2 T5 ?# C; w, k' ~< 0 = Error# u) Y8 n  p  H- b5 }8 a
= 0 = File Exists5 `" y- W- H9 ]( e9 f+ i$ k
= 1 = File Does Not Exist
, v, \0 \# i) J! `8 n% z) O+ a  K. X8 b- r9 {( D

4 n/ Z  f+ ?/ n7 t. A) lEnvironment
3 y/ m! `5 X4 B

5 A8 V' O( t' Q7 p7 M' i7 B: R2 ZInternal and External
; Y7 u0 v# C- l; i) |, b; @& v* y- w7 f" s; ]* S8 `2 W

; n4 G* }+ k5 i$ M0 c: i% ~See Also
$ y8 V$ [" A: T& t* p5 A7 h

/ [8 t) ]% o) E1 |# n( A' rFor description of file types see table
, K9 P& K; E7 q7 `6 W4 E- {
! M2 K& j" \- d: ^

9 k8 Z! v8 Q+ DRequired License(s)( |  z4 K, ~2 @( C
; x0 i9 Q0 V; f& L' E0 R7 \! ^
gateway
' `; A/ |( h7 E; C; W: H

5 D3 Y8 M9 E) H0 S, h6 G+ Q+ m$ o2 x0 X% c/ ?+ k3 i

8 M2 }8 M/ o1 }& U9 nint uc4560
5 f5 d& Q' _+ Y3 j(
; K! u0 n3 r5 |6 T" E  G$ e' ^const char * fspec,
* y4 J2 N/ ~# V2 `int ftype3 _8 Z3 {/ f4 T
; V( Y" B/ O! [, J9 @
)
! ?. g4 a7 M+ A
& c0 v+ ~; ~" L; g
const char *fspecInputFile to check
intftypeInputFile type
% p6 G( f0 p+ c2 j; I. \3 F0 will check for files
3 B3 N/ t  K: v& m% w100 will check for directories
9 G8 \8 C) e+ J2 l! M0 B# E7 [

0 c' u9 B. z+ ^  T; _# b$ J* [" s/ J! A4 o
查找文件也可以通过UF_CFI_ask_file_exist
  W  P0 U. t! @1 q. ?( _( `8 h* t% O& ~7 G9 g
UF_CFI_ask_file_exist (view source)# o% P; a$ [# m$ U! \( Z/ \* j. [% t

0 x- \- @9 _) y$ b1 \' n+ F6 g, nDefined in: uf_cfi.h
. W+ y0 H: W8 N3 D
  N$ y8 M: z1 _7 {
+ `. A- k7 n2 G% k
Overview% x7 D# M- O8 @) f& [% C8 D8 u
9 ?' p) o/ i# r' j- v
Test if a file exists.
% T5 k# ^( Q. A9 f9 L& Y9 A* |( M' X& C' M7 O  @" j& e: H
Note: This function only works with files - not directories. To check if a1 n0 {% ?/ u6 f- A5 o3 o
directory exists use uc4560 and pass a file type of 100.+ t1 b, s% s5 k+ d: q* P

) H2 H' R8 b1 V8 A9 D9 X. z
; t3 Q6 C. B) ]' L, h7 t
Return
5 W: @$ x; d  r2 x& J
3 w- u9 B8 H$ p: r/ C
0 - No error/ E0 p+ l4 _1 D+ b
Otherwise - Error Code
! g+ p, A- m- ^1 M0 l4 ~8 P3 J6 R: I) X% I
1 S8 P) u  a5 _# B$ ]
Environment4 F1 Y$ B: N/ p

/ A8 j1 E& t$ B- ~Internal and External
1 j/ _  o8 N2 N& t, G7 k5 I! ]1 e- @' z! F) p; L
, f  N3 s/ ?7 E2 j8 H2 |  |
History
4 ?+ f  J* A: z9 U/ i
6 [# m6 u) V2 `  ]  d- w  M5 h
Originally released in V16.0
% ~- z5 b* i0 J& x% v. K! y ) D4 h: b8 c: d, q9 _+ t

( J- Z/ \, ], P5 s* `5 j, i; yRequired License(s)5 E, K9 q" [8 {1 i6 X/ ?/ R& G, j
, o9 L6 Q: m' x) h
gateway
. m/ Z. j6 v5 s) X5 c

' |+ z! N7 L; @: E8 V
2 R; C; S  J5 v' e& o& | 5 r' X; C# U* b( n6 g
int UF_CFI_ask_file_exist/ m" y) B" t6 j  e
(
& s7 g9 P) P) Jconst char * file_spec,+ V5 {2 a: I1 o5 ?& A1 z" ?1 M5 ?
int * status2 w3 C% d, a$ O' ~
: T- b" ~& T  j) r. \& H
)
* p, P% [% r# K2 m2 z
& B6 `$ E( ~5 I, B6 ]
const char *file_specInputThe file to check
int *statusOutputFile existence status.2 W9 y+ M; S" X$ s  @7 H# M8 }
0 - file exists
1 L7 D3 G2 C6 S1 - file does not exist( G9 ?1 Z  F& A
; A6 f2 f) T( `9 H; a# \2 G1 U7 n
  Z' T) r! O4 D9 U' k4 U) X
上海点团信息科技有限公司,承接UG NX,CATIA,CREO,Solidworks 等CAx软件,Teamcenter,3D Experience等PLM软件,工业4.0数字化软件的实施\二次开发\培训相关业务,详情QQ 939801026 Tel 18301858168 网址 www.diantuankj.com/ doTeam.tech
回复

使用道具 举报

发表回复

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

返回列表 本版积分规则

  • 发布新帖

  • 在线客服

  • 微信

  • 客户端

  • 返回顶部

  • x
    温馨提示

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

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

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

    我知道了