主题 : 使用C#读写文件出错 复制链接 | 浏览器收藏 | 打印
级别: 新手上路
UID: 35641
精华: 0
发帖: 16
金钱: 80 两
威望: 16 点
贡献值: 0 点
综合积分: 32 分
注册时间: 2011-01-04
最后登录: 2012-04-18
楼主  发表于: 2011-11-02 21:40

 使用C#读写文件出错

我使用C#做了一个监控系统,使用文件来存储系统报警信息,一产生报警立刻写入文件,报警条数一定,所以文件是固定大小的,平时运行挺正常,但是报警多了而且很频繁的时候,就会出错,程序崩溃,弹出错误信息,请高手帮忙解决,非常感激!
报警信息如下:
System.IO._WinIOError(Int32 erroCode,String str)

System.IO.FilrStream.WriteCore(Byte[]buffer,Int32 offset,Int 32 court)

System.IO.File Stream.Flush Write()

System.IO.File Stream.WriteByte(Byte value)

System.IO.Binary Writer .Write(Byte value)

batt.CData. writeAlarm File()

batt.CData. writeAlarm DB(Byte type,Byet id,Single value)

batt.MainForm.lbTimer Timer_Tick(object sender ,EventArgs e)

system.Windows.Forms.Timer._WnPro_(WM wm,Int32 wParam,Int32 IParam)

system.Windows.Forms.Application ThreadContext._Internal Context Messages(WM wm,Int32 wParam,Int32 IParam)

Microsoft.AGL.Form.EVL.Enter MainLoop(Intptr hwnMain)

System.windows.Form.Application.Run(Form frm)

Batt.Program.Main()