查看单个帖子
旧 2009-04-22, 12:53 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】请教怎么样在后台判断dwg文件可写

请教怎么样在后台判断dwg文件可写
www.dimcax.com
请教怎么样在后台判断dwg文件可写
请教高手,我要写一个后台的批处理,最后需要保存我要怎么判断需要处理的dwg文件没有被锁定或只读?如果只读的话就不处理
代码: using system; using system.io; class testrw { public static void main(string[] args) { filestream fs = new filestream("xxxx.dwg文件", filemode.openorcreate, fileaccess.write); if (fs.canread && fs.canwrite) { console.writeline("myfile.txt can be both written to and read from."); } else if (fs.canwrite) { console.writeline("myfile.txt is writable."); } } }
可以这样直接读取文件判断dwg文件啊?谢谢啊 cad自己没有函数吗?
你加'using system.io; '就可以了. 不就是 filestream fs = new filestream("xxxx.dwg文件", filemode.openorcreate, fileaccess.write); if (fs.canread && fs.canwrite) { ........................... } else if (fs.canwrite) { .............................. }
我的意思的cad自己的方法里面没有判断的吗?比如map读取的时候会有一个dwl文件提示锁定了dwg
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)