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

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

[复制链接]

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

2470

主题

1275

回帖

8万

积分

管理员

PLM之家站长

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

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

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

x
2 l* y, [' g4 c) V4 u
# `! _0 l) `3 {, X. w  l; f0 V
在进行相关文件和文件路径判断时候,ufun提供了内置的方法。& F8 `- Z$ j. z8 Y8 h; y3 O3 m0 I
UC4560 通过设置第二个 参数为 100 可以判断文件夹,通过设置 为 0 可以查找文件。7 ]+ D0 Y% A) O# A9 g% c" A

2 l& N6 [/ ~& b
6 T- t( ^8 O( n9 x* Z( t4 x4 t3 y, U+ E' i! L

+ d  N' s8 ]8 O3 e& Uuc4560 (view source)& N* h$ X9 d3 b- w

' ]0 u+ `+ v( m7 v5 NDefined in: uf_cfi.h% u. y+ f8 [9 b/ n8 j3 x4 ]
9 E7 C& k: @% |8 k" Z
* q% F+ F4 o- H# J2 m0 y3 J. F
Overview8 I! G0 |; z3 u! l) b% |
8 R6 N& M# n$ B
Checks whether the specified file of the given type exists.
, c8 E2 V( p. R5 a: E8 l7 X9 S4 w1 q& q' e! e
NOTE: Mixed or upper case file names may not be found if the& q; C9 ?4 \6 q# [- P
environment variable UGII_OPTION = LOWER is set.) _" r7 r' ~9 h
! T- R  |8 n: p' x4 W
Passing an ftype of 0 will look for a file but does not work for a directory.4 [1 s8 j8 o9 T7 h% I- o
To check for a directory the ftype must be set to 100." p& e+ C/ D* R1 v6 K% d6 v6 a0 A

' K4 q( v  y7 Y7 ]$ L$ |

. W5 S* a$ I* s  mReturn- Y- i% o' i% f. E. _3 p

2 l( U3 U% Z: uReturn code:
) w+ Z4 B! y) P& H' {6 T< 0 = Error
) d' |% u' c- s# k. }8 X= 0 = File Exists
: x/ J2 |8 t* l9 C: r! p$ _= 1 = File Does Not Exist0 k8 K  e* X6 ]* z

7 u; S% d! `7 j% a

9 `# b. E" a) {8 W0 z5 h* oEnvironment
# _, K$ D  s. G& }8 i( s9 U0 |

9 P! U- ^# Q, ^, YInternal and External3 n; g! k6 S1 ]* k

' y" `- Q$ y% ^3 }
9 A. ~" Z# k7 o4 `% q9 g
See Also7 p% c5 k0 i' X& _3 D$ `/ m4 S

# S. K. }% O; }' e! K3 \- oFor description of file types see table$ `. t& D+ b/ B  t1 b# j

- S$ u; z, c' z

4 k" S0 f3 S) oRequired License(s)0 L# Q. ]- p% ^( a' s
9 d! z% o$ Q  j# E5 R. e" r
gateway2 l7 d2 F1 V% C/ ]

2 y6 b7 [' P; k5 i' I3 y8 c
! I. ]. A9 A4 L# R
# {4 c) t- {' P* Zint uc4560
2 u7 y4 n- i+ U6 e/ z(8 d! }! U0 L; j% I3 P1 l
const char * fspec,4 j5 w7 x+ \( P/ [- P6 ~, M8 r2 f
int ftype
+ g8 D; j. g0 u9 R# K+ `1 g: ^/ `, _- m% O/ V( e0 `
)
) p3 V& S0 r% I* D
5 t4 O5 m! H' w! X
const char *fspecInputFile to check
intftypeInputFile type
& r7 X8 K. F) l; O: Z0 will check for files0 ^8 l9 }" T( N1 R6 r6 D; f
100 will check for directories

9 F0 u& A( \) j$ H# [2 W( z. ?1 R2 P0 v  `- b. }! a$ _) L, m
* h: z% x1 ]' W# [; S
查找文件也可以通过UF_CFI_ask_file_exist
9 U" n* I; X0 y* u3 x1 k, L
! @9 B7 J9 S2 T, jUF_CFI_ask_file_exist (view source)
. O) g& |6 i7 L( r; B ! {7 h5 _7 _' S% r
Defined in: uf_cfi.h
% u9 g, V# ?& f
& p* K* a, H$ _$ Q

& k, y" m# Z- w( f+ c9 w* [Overview
3 o8 Q6 ^& |; ]' C% Y
" j+ v% K( x( X6 s
Test if a file exists.
2 Z7 Y& j: A' S$ X
1 u4 d- M! _6 Z" A# F) `Note: This function only works with files - not directories. To check if a8 E" a/ L& m+ j% L
directory exists use uc4560 and pass a file type of 100.
( k/ U! o' N9 g' I
7 Q' g  o2 g- s. M' S

7 S( Y4 Z# W( e- A% k* b+ sReturn
- z; r+ n3 B5 [/ R/ g  e4 _
: ]* b8 L% _# z" Z9 O
0 - No error" d+ l! W- Y# [1 `( I1 ]8 K
Otherwise - Error Code5 q( z, y' }1 m; p6 w/ M% T

) w2 O4 P( v- y/ h) v5 m

- [: ~* a/ d- l! [- @# cEnvironment1 [9 m% G4 o1 h4 d& G! `" [* M
4 p0 W. ^8 }. O. {, H7 j
Internal and External
, @- w2 _/ a* q+ k3 }' E
$ h( h5 ?  g+ q. X3 o+ M

5 D0 ^6 D! x6 j3 {1 ?5 C+ uHistory6 O4 [! ?5 x( k4 T' r: N' b

3 |6 `# C0 H, NOriginally released in V16.0
) q, m3 D4 U0 ]% R0 B 8 o! P; Z& I0 w  o
3 T9 w8 N9 p) v8 G0 M) u
Required License(s)
" ~7 w( c# k; a6 d: j0 N

3 S( _1 a5 u2 `3 a/ lgateway
. j: L1 P8 K& S$ k0 t& i

  L0 I1 I, o2 F+ ^5 n/ ~: c4 h( a% n! z" Z) c# p: ^+ g# F) k8 `
( z9 S. ^  ?& e  \0 j
int UF_CFI_ask_file_exist! n, x! V* E) q. I, D) Z% }
(
. }4 v( u4 S9 j! Z8 ~# `const char * file_spec,
  @4 s" |- _8 K# u+ r' {, ]int * status4 y" x- q) R0 X+ y' v8 d' V
6 `; d, G' k- l1 h( F) n
)
) F- |( x. ~! ~4 E. C
; f5 o: Z! u. }& @! j3 i
const char *file_specInputThe file to check
int *statusOutputFile existence status.
' y% P: J8 {- y5 q0 - file exists
5 @+ a4 F# e3 Q  J' j( F5 G1 - file does not exist
* s& C3 x3 v( n, j+ T. @/ G3 g2 O: B2 C# P# N3 t4 D
+ w  Q5 f0 M; z. b4 l* O
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了