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

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

[复制链接]

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

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

admin 楼主

2019-10-9 08:31:23

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

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

x
9 }( N  |6 y$ ^

; y8 S1 k3 r% W! U& m! P: F. g在进行相关文件和文件路径判断时候,ufun提供了内置的方法。% K  ^3 \# p3 _& G
UC4560 通过设置第二个 参数为 100 可以判断文件夹,通过设置 为 0 可以查找文件。$ J' f/ [6 L+ E& _: B( E2 |5 C/ m2 C
- E, ^/ M/ F# o2 N" [5 e3 Y, ]

) }+ [0 G# M4 N" L8 u' A% u& i0 @0 P( g
4 G/ k* u& f3 d
uc4560 (view source)
" \; T, [4 A2 q
9 N7 [: [5 R2 ^  F6 x" TDefined in: uf_cfi.h
% Z& Y0 s3 V! W; K/ b9 C
+ T0 s2 v. h! D0 {( N
0 w* ^' P, K; d% O1 v/ |6 Z
Overview# [2 q0 A* q4 T- Y

8 k, ?# ?+ S7 Q8 X0 d% o. {Checks whether the specified file of the given type exists.
' m( o" v. }, H& A+ \, z  E
4 ~9 J/ ~7 V" l: ^# _( j* m3 wNOTE: Mixed or upper case file names may not be found if the# d0 `2 c8 Q2 k% n( X
environment variable UGII_OPTION = LOWER is set.0 j/ D/ g5 @" J" N9 Z3 `

8 J, [  M8 z3 S0 G- W9 f: i. uPassing an ftype of 0 will look for a file but does not work for a directory.
, k* [( s" G' z6 y1 \* ~9 o* eTo check for a directory the ftype must be set to 100.0 Q2 r/ t" a$ f2 c/ r  n

* n9 x0 `8 Q2 h3 _. |

$ g% T, m  [. \Return
. ~9 F3 ~3 \: L6 e4 a
; Q" n0 v+ D: A+ p3 e3 l
Return code:' ?( ]/ v8 z1 X7 e! g1 H
< 0 = Error4 i* }; f& u; D/ k) N
= 0 = File Exists
# Q9 y% `1 ^7 {8 S= 1 = File Does Not Exist
0 q8 i4 I  ?! i* |
& \7 |' A- ]6 D! R5 ^" J; h

4 d. z/ p2 F0 L' P* |Environment8 X; n- K: w$ C; n- M; x. h

: X. R5 n6 H6 d( xInternal and External
( R% T2 Q5 B) J& u( V- t+ _* c" j
. {# e# `- r2 f1 M
' l0 X9 H" P+ W3 y
See Also) c5 m  [* E" t  C# }

( P! q7 X6 r: V' pFor description of file types see table0 E# i* ]  a, `$ L! x3 ~

/ b2 T( M/ m( U) P7 W

/ K0 Q3 k: x+ F* v: lRequired License(s): t4 i: s' N) r' Q

, L& f6 r' U% V$ fgateway; k% \" w. X: }% s5 Z

1 M. y" A6 L4 F* |8 `4 p* y( y
/ o5 t  R6 G, H# z  y, y ' n7 u' A6 y8 t& x" G: |! v: ]
int uc45607 c/ a. l+ y7 t
(, t+ l' ^/ m4 M
const char * fspec,5 s" W4 M7 p5 H( T7 V
int ftype0 h4 V* i. q5 D* v* O; y8 R1 h
, L, b0 w' ~" z2 l* C; D( H% p% D! A. v
)$ ?' }: g+ F2 h9 t, ~2 I
1 j1 L7 v& c8 T4 c& ~- q( r8 V" w/ h
const char *fspecInputFile to check
intftypeInputFile type
- d. g/ f' B6 m5 M0 will check for files
; w9 g+ M& V2 a! I$ s/ S100 will check for directories
7 B! k4 g3 r$ O2 J. |$ g# E8 l

6 l' Q; W: f! f3 K1 a* o$ s: v$ s. S* \& E
查找文件也可以通过UF_CFI_ask_file_exist
6 L) h6 F7 A- h7 W- @
3 [. O6 O3 K+ ~  G& V* c* d) SUF_CFI_ask_file_exist (view source)2 C! n0 v( s# W

0 ^; V& t( g( A* F% y; Q# cDefined in: uf_cfi.h( n/ {" P( B6 a: P8 G

' b$ ?& M  K- Z0 W  _# c% c8 P* A

! \) [5 B/ i3 MOverview0 m1 L' ~4 A# \8 M/ |' i5 n1 a

7 K- D3 _( S/ s4 KTest if a file exists.) @! r) n) v. m& A* ?) T4 r% C7 F' K

' r5 x6 W  d3 f9 J" NNote: This function only works with files - not directories. To check if a
( B; v9 Z) u1 @# P1 Kdirectory exists use uc4560 and pass a file type of 100.
9 x) c) ~" ], O+ t
  K" m9 }0 u1 L

- u  V0 }% c1 A- s% R# j) M3 ~- h* r+ lReturn
& {% f% B/ Q, l# }
' `% S' V4 ]  `$ \8 z5 |
0 - No error4 E* V/ m8 @8 z! F
Otherwise - Error Code
( c% T, l2 [7 F% \9 @: {# ^
  L% f" w  D1 v* Z) r9 v% u2 s

: d# Y7 ^; Z% u5 x# ~  MEnvironment
: j: A9 Z9 S2 b5 h) H
( {( D# D3 e3 {0 D2 u8 D6 E
Internal and External3 a/ Z" c: y# r
% N. l9 M/ b9 s& {
( ^. I& r- B* j
History
& @9 k$ ]" I6 v' C1 z9 p, B

( f, Y) }$ {" w( Q% FOriginally released in V16.0: {# H5 R- h# f, u0 G/ t4 A3 r0 g% K

# r- F6 Y( J' Q( j2 g: w/ S5 T9 p
! Y6 E3 D" ~* [+ w, v
Required License(s)8 c/ D0 R; l- S
6 S4 M1 g' ~0 ]; E
gateway
& z) e$ f7 m* i' m4 \' R. i/ L
9 |' b) K1 I$ D

! `9 \5 q6 b1 t0 G1 X( Z2 E
8 R$ o3 M0 q5 J. aint UF_CFI_ask_file_exist+ m1 x1 F# Q* a$ X+ h
(: L( o. ~0 F6 r9 |
const char * file_spec,
( P, [4 N8 ~* A8 kint * status
6 s5 [! g$ M- o9 h  q. Z$ \% W9 e) {% ]  T
)+ Z9 @8 T6 ?' U! j
. i4 p7 w2 G: b: J+ L6 ?
const char *file_specInputThe file to check
int *statusOutputFile existence status.# M2 @6 ~; Y! }- o1 u+ J
0 - file exists# F- d6 n  e+ e
1 - file does not exist
6 l" C- D! j# d' i% V
5 v1 t  M7 ]& h8 j
2 n# l* g2 U7 F4 K+ [4 ^3 X2 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二次开发专题模块培训报名开始啦

    我知道了