Delphi Error 103
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more erreur e s 103 delphi about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users delphi i o error 103 windows 7 Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping i/o error 103 windows 7 each other. Join them; it only takes a minute: Sign up Delphi: Why do I sometimes get an I/O Error 103 with this code? up vote 10 down vote favorite 4 In several of my apps I have
I/o Error 103 Realterm
code similar to the following: if ForceDirectories(ExtractFilePath(lLogName)) then begin AssignFile(lLog, lLogName); try if FileExists(lLogName) then Append(lLog) else Rewrite(lLog); Writeln(lLog, lLogLine); finally {$I-}CloseFile(lLog);{$I+} end; end; In one application, the first time I try to execute this I consistently get an I/O Error 103 exception on the line with the Append statement (the file does exist prior to calling this). All subsequent attempts at the operation will work fine however - until I restart the app. All the docs what does i/o error 103 mean I found about this error so far indicated that this would either be caused by calling CloseFile without prior Reset or Rewrite (Append typically isn't mentioned) or if the file was in use by another process. As the exception occurs before the call to CloseFile it obviously couldn't be the former. I already tried inserting a Reset right after the AssignFile for good measure but then I get the exception on that line. There is also no other application overtly accessing that file. I say "overtly" because I do have a slight suspicion that anti-virus (TrendMicro in my case) might be the cuplrit here (so maybe the file is in use). If that was indeed the problem, what would be the best way around it? Hard-coding an automatic retry does not really feel like a clean solution to me... Another case where I sometimes get the 103 error is this code, which I use to create an empty file (or more often to empty an existing file): AssignFile(lFile, AFileName); try Rewrite(lFile); finally CloseFile(lFile); end; In this case it's much harder to reproduce. It happens a lot less often. Most of the time this seems to happen on the first run after I recompiled the application. Could this again be the anti-virus getting in the way? I have only ever seen this happen on my development machine and n
Search Advanced Search Go to Page... Thread Tools Display Modes #1 06-13-2002, 02:11 PM MrBaseball34 Senior Member Join Date: Jan 2001 Posts: 7,260 Prevent I/O i/0 error 103 Error 103 Not used to Std. I/O operations... When using AssignFile and CloseFile,
I/o Error 103 Screensaver
I am sometimes getting a 103 error (File is not open). How can I check to see if, in fact,
Rewrite Delphi
the file is open before the CloseFile call? MrBaseball34 View Public Profile Visit MrBaseball34's homepage! Find all posts by MrBaseball34 #2 06-13-2002, 02:37 PM vandub Member Join Date: Aug 2001 http://stackoverflow.com/questions/634587/delphi-why-do-i-sometimes-get-an-i-o-error-103-with-this-code Posts: 44 RE: Prevent I/O Error 103 you could use the {$i-} command then check the ioresult for an error AssignFile(F, FileName); {$I-} Reset(F); {$I+} if IOResult = 0 then MessageDlg('File size in bytes: ' + IntToStr(FileSize(F)), mtInformation, [mbOk], 0) else MessageDlg('File access error', mtWarning, [mbOk], 0); vandub View Public Profile Send a private message to vandub Visit vandub's homepage! Find all posts by vandub http://www.delphipages.com/forum/showthread.php?t=58954 #3 06-13-2002, 02:37 PM HTML Senior Member Join Date: Jan 2001 Posts: 2,977 RE: Prevent I/O Error 103 Hello, This site has many examples on File I/O and uses IoResult(should return 0 if successfull) in few places in the snippets. http://homepages.borland.com/efg2lab/Library/Delphi/IO/FileIO.htm If perhaps you can post a snippet of your code that you think cuases the problem , that would help. :-) HTML View Public Profile Send a private message to HTML Visit HTML's homepage! Find all posts by HTML #4 06-13-2002, 10:35 PM PoseFant Senior Member Join Date: Jan 2001 Posts: 1,002 RE: Prevent I/O Error 103 you could use the {$i-} command then check the ioresult for an error AssignFile(F, FileName); {$I-} Reset(F); {$I+} if IOResult = 0 then MessageDlg('File size in bytes: ' + IntToStr(FileSize(F)), mtInformation, [mbOk], 0) else MessageDlg('File access error', mtWarning, [mbOk], 0); --- Regards /Filip I've lost my autosignature ... *sobbing* ... PoseFant View Public Profile Send a private message to PoseFant Visit PoseFant's homepage! Find all posts by PoseFant #5 06-14-2002, 05:34 AM MrBaseball34 Senior Member Join Date: Jan 2001 Posts: 7,260 RE: Prevent I/O Error 103 Hey, Filip, did you jus
f: TextFile;) The Line with Rewrite crashes with I/O Error 103: ERROR_TOO_MANY_SEM_REQUESTS (The semaphore cannot be set again.) What does that mean?? http://www.delphigroups.info/2/6d/479235.html What is wrong? Thanks, Philipp Adam Fli Delphi Developer Wed, 26 May 2004 00:14:06 GMT Re:I/O Error 103 I/O Error are not the same as Win32 Errors. This is Run Time Error as named in old Borland Pascal. The number 103 means File Not Open, but it is not predicted to apear on rewrite function. Please check if it is on error 103 this function. I belive that file is not created correctly and so it is not opened. You may send more code too, that i can se what can be wrong. Adam Quote"Philipp Crocoll"