I have a program that has been running for years and now I suddenly get I/O
error 103. I'ts running as a windows service.
The code loooks someting like this
Try
AssignFile(F, FileName);
If FileExists(FileName) Then
Append(F)
Else
Rewrite(F);
Try
While DataAvailable Do
Begin
-- Do some processing ---
Writeln(F, Dtata);
End;
Except
On E: Exception Do
Begin
Logg('Process error: ' + E.Message);
End;
End;
CloseFile(F);
Except
On E: Exception Do
Begin
Logg('Open file error: ' + E.Message);
End;
End;
Last days it started to logg I/O error 103. It's running on a Windows 2003
server with F-secure antivirus (same problem with antivirus disabled).
I randomly get "Process error: I/O error 103" and "Open file error: I/O
error 103". Nine out of ten times there is no problem whatsoever!
The machine get's windows updates from WSUS automatically. I run ChkDsk /F
without errors.
Please, any ideas?
Regards, Mikael
> I have a program that has been running for years and now I suddenly get I/O
> error 103.
From my old Borland Pascal Programmer's Reference:
I/O Error 103 = "File not open", reported by Close, Read, Write, Seek,
Eof, FilePos, FileSize, Flush, BlockRead, BlockWrite if the file is not
open.
--
Kent Briggs, kbr...@spamcop.net
Briggs Softworks, http://www.briggsoft.com
regards, Mikael
"Kent Briggs" <kbr...@spamcop.net> skrev i meddelandet
news:4710d86d$1...@newsgroups.borland.com...
Suggestion 1, alter the code to give more information when an error occurs.
For example, does the error always come after an Append or a Rewrite or
both? Or perhaps you know already?
Suggestion 2, if your code gets called often, FileExists may be letting you
down, because it tracks through the file system and may not be precisely in
sync with what is happening. Windows requires time for stuff to propagate
around, and multi-core CPUs add another variable. I know the FileExists()
sequence has been used from the days of TP, but it makes me uneasy and I
often use a TFileStream which can open existing files or WinAPI CreateFile
for total control.
Roger Lascelles