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

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

[复制链接]

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

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

admin 楼主

2019-10-9 08:31:23

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

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

x

" h1 ^, Y2 I! d6 z1 e' V) @# W6 ~( u# [5 s, x) m( g
在进行相关文件和文件路径判断时候,ufun提供了内置的方法。
0 |  b# t' X# F2 W3 ~0 tUC4560 通过设置第二个 参数为 100 可以判断文件夹,通过设置 为 0 可以查找文件。# y  w0 U8 h( G7 e- i2 T/ j

( R' `, B  j5 }$ k$ K3 d
+ \+ i9 S7 L8 u' d9 Q6 B$ a
* I8 t3 P' k$ A0 S
1 f$ w6 G6 s7 \3 z5 _uc4560 (view source)/ x0 g: w7 u; _6 Y
+ T. ^7 l% \( S) k3 n7 M
Defined in: uf_cfi.h
+ M( z  L( Z, \! o # B* K7 M- u: O, B+ _; V

- J0 |5 ]( U4 w! ^6 w8 _2 m' u- e& dOverview
  }, h) \4 k' \
, y0 ]/ ^$ m0 t8 P
Checks whether the specified file of the given type exists.
3 `. }3 ^4 G; ]! T3 n8 a0 c
5 W7 ]. U1 C6 }* s  W* y, Y& uNOTE: Mixed or upper case file names may not be found if the; p8 j' ?5 ]0 U9 P# R8 K
environment variable UGII_OPTION = LOWER is set.
3 E! q* T* H6 U0 K# e. ~, f: u; @8 X- j& c' ^
Passing an ftype of 0 will look for a file but does not work for a directory.+ [6 x0 M, P2 G: _' a: h' F' ^
To check for a directory the ftype must be set to 100.
5 O9 v- ^5 l, E' |- |' Y# @: x! x) W+ W# ^' k# @3 s
8 [7 g8 V: K: N% ~4 ?
Return
/ o# Z* v2 L! O* v( g+ b7 X7 g

& L* R$ F+ }4 T5 OReturn code:  I; N) K& b4 w8 x5 u) r* L* t
< 0 = Error
1 U6 ~4 _* A" D+ Y= 0 = File Exists# T$ w9 p* P1 l$ G1 t! g* z# P' l
= 1 = File Does Not Exist, c9 b1 y. P# v6 r8 P5 X

% l- p( }' l0 k9 K) ^" e& w5 t

& ]6 e$ y' L$ |8 dEnvironment
: L" v& |& ]/ J( a2 s; N. o

' a2 s3 M/ a, D) s+ cInternal and External
- ^' I% J* D' l2 m1 f) H& J, k7 ]' l% ?" @& b/ v0 n5 h0 y3 G9 ^
# M8 a0 g1 b$ d& [
See Also
7 g! T* w, w  o( ~

* v2 B# F" V, p7 w; P+ jFor description of file types see table
* j5 A! Z, \9 d0 W* F* ]
' E4 H* k% N+ H/ p3 B" {, ?2 A
7 W, _# n! }3 J3 x0 Z$ `! q) y
Required License(s)
& ^$ x) J9 y6 H, o6 H, G) s# t

" k- d, G- p3 T- Wgateway
& G4 t5 H" T" T2 E

" v$ o3 l3 c- h' g/ Y! m( N% l7 t" z, ^

% g6 ]8 E! h1 r: _: E- A- wint uc45601 q( S. E7 `, z6 r2 d
(2 W) r! Y; A7 o8 C
const char * fspec,( P# U0 N( j; h  Y' P+ s
int ftype
+ x9 B  c9 P8 \2 _  h' i8 G" A% m  f" E
)
' N  P: ]: f) O9 L. G+ Z
4 }* u6 z* X& t/ o/ D
const char *fspecInputFile to check
intftypeInputFile type
0 E6 J! K, |+ |  `0 will check for files, ~0 n6 X; R' {. N1 Q
100 will check for directories

1 y; O4 v$ A9 l
' y7 u- H2 r0 p) _' N
0 K/ c0 b5 i( K+ v查找文件也可以通过UF_CFI_ask_file_exist5 e% f; I  Z& S6 Y$ l

) i8 V9 i; d& X/ x( {: YUF_CFI_ask_file_exist (view source)- l+ @& A- b: s7 f5 T# W5 Y. E

* s) h$ M4 W  }. `Defined in: uf_cfi.h
( m  k1 ]# R9 v2 v
2 ~1 M4 S' Q9 D& J) G

5 z6 x2 v) a- A7 o; m) IOverview! D2 g$ F2 ^% [& o) J% E+ ?
0 K- i8 W+ e; F, `  @' O
Test if a file exists.3 Z2 T# T) [: h2 ~" o+ H! d
* i% H: {$ l5 r, c- M' U! C: E
Note: This function only works with files - not directories. To check if a
# k& |9 W7 v6 F+ rdirectory exists use uc4560 and pass a file type of 100.
: o" a& A  N9 g5 a' S1 J; c8 e& D7 g0 s* ]8 p* D) \
- ~4 T2 _3 W0 s
Return0 i( O8 e( P6 ?' y! H, ~4 [7 k6 q. \
' R, t: G. L6 `7 `2 p* K
0 - No error  J2 R+ r& Y! t1 Q: Y* \
Otherwise - Error Code
6 A! k$ y3 ^0 z6 G6 b, V9 Z6 x  @" |" j* O3 C
; A, W1 }  c9 L) U) i
Environment
: F9 @( u; Z9 I: h
7 F& K7 `7 f- b$ t
Internal and External- A; G$ V3 p' N, T; v8 d: b
9 ~$ L, e- z# Y/ [% C

) R9 R3 x5 @( Q" @: zHistory
- _- D" m2 B2 g2 P; _8 q' k
! S* [/ [* d9 m6 i2 Z+ @7 B+ z* P7 a
Originally released in V16.0
1 Z3 b1 W3 J# h: U$ Z 0 R, \. q5 R8 C  S* n

1 R8 h1 s0 g2 i) i4 gRequired License(s)0 W. B/ i7 K; n7 [
2 q; t0 e( M% r
gateway
. c4 r3 l7 S. w) G5 J& m

- a7 D- \5 C7 e  i/ Q& F
. B: K" b% @" Q3 c) x/ s# [0 r+ ? 7 B. V7 v$ U+ y
int UF_CFI_ask_file_exist
5 r( V4 Y; t. t: Q(1 u7 e3 r! P+ M
const char * file_spec,& B0 }: l' w2 l  b( |3 A
int * status- Y! p( F' g2 S- l+ {
4 n+ ]) _( N9 }0 s; O. N+ W: h
)
( f! w) P, c. ?) z+ O& a( X

  U4 I* T+ u4 l1 W1 f
const char *file_specInputThe file to check
int *statusOutputFile existence status.
+ h# H9 i& A5 B, j4 o' p) U0 - file exists6 Q9 _# d5 N$ y. L
1 - file does not exist: X* N  e( U; {/ Y: I
: Q( a) s' R' j9 G7 r5 [
# N6 x; ?  ?  Q: E
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了