回到更多问题,立即处理文件! [英] Back with more Questions, File Handling Now!

查看:107
本文介绍了回到更多问题,立即处理文件!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

Struggle继续,我现在在使用StreamWriter写入结果文件时遇到IOExeception。 ile'C:\ Users \glennp \Desktop \VB2008_Test_Rig_modded with SendAndWait - SaveWorking\VB2008_Test_Rig\bin\Debug\FailResults.CSV'因为它正被另一个进程使用。我正在关闭通过

Hi All,
The Struggle continues, I am now getting an IOExeception when writing to the results file using StreamWriter. The ile 'C:\Users\glennp\Desktop\VB2008_Test_Rig_modded with SendAndWait - SaveWorking\VB2008_Test_Rig\bin\Debug\FailResults.CSV' because it is being used by another process." I am closing the stream after I have written out data by

'all pass
If ((VoltageTestBool = False) And (TimeKeepTestBool = False) And (LCDtestBool = False) And (RFtestBool = False) And (RFxtalBool = False) And (RFtestHighBool = False) And (QuiescentBool = False)) Then
    Result_Save += "Unit Passed," + DateAndTime.Now
    outPass.WriteLine(Result_Save)
    outPass.Close()
End If
'volts fail
If ((VoltageTestBool = True) And (TimeKeepTestBool = False) And (LCDtestBool = False) And (RFtestBool = False) And (RFxtalBool = False) And (RFtestHighBool = False) And (QuiescentBool = False)) Then
    Result_Save += "Voltge Test Failed," + DateAndTime.Now
    outFail.WriteLine(Result_Save)
    outFail.Close()
    StopTests = True
End If



我没有在另一个程序中打开它(问题确实在我在Excel中打开文件并关闭它之后开始)从那时起我的电源循环我的机器以确保任何跟踪关闭。我检查了文件权限是否只读取它们?

任何一个想法?

Glenn


I do not have it open in another program (the problem did start after I opened the file in Excel and closed it) since then I have power cycled my machine to ensure any trace closed down. I checked the file permissions no read only on them?
Any one any ideas?
Glenn

推荐答案

尝试使用 File.AppendAllText ()而不是为你处理打开/写入/关闭: http://msdn.microsoft.com/en-us/library/ms143356%28v=vs.110%29.aspx [ ^ ]
Try using File.AppendAllText() instead which handles open/write/close for you : http://msdn.microsoft.com/en-us/library/ms143356%28v=vs.110%29.aspx[^]


这篇关于回到更多问题,立即处理文件!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆