Io 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 about hiring i o error 103 windows 7 developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask
I/o Error 103 Realterm
Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join delphi i o error 103 windows 7 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 code similar to the
What Does I/o Error 103 Mean
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 I found about this error so i/o error 103 screensaver 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 never gotten a report from a customer. As with the first scenario this
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 Error 103 Not used to Std. I/O
I/o Error 103 Windows
operations... When using AssignFile and CloseFile, I am sometimes getting a 103 error (File is
I/0 Error 103
not open). How can I check to see if, in fact, the file is open before the CloseFile call? MrBaseball34 View Public delphi rewrite Profile Visit MrBaseball34's homepage! Find all posts by MrBaseball34 #2 06-13-2002, 02:37 PM vandub Member Join Date: Aug 2001 Posts: 44 RE: Prevent I/O Error 103 you could use the {$i-} command then check http://stackoverflow.com/questions/634587/delphi-why-do-i-sometimes-get-an-i-o-error-103-with-this-code 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 #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 http://www.delphipages.com/forum/showthread.php?t=58954 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 just simply copy vandub's post verbatim? Anyway... I want to know how to determine if the file is open before I call FileClose. If I use Reset, what will happen to the file if it IS open? MrBaseball34 View Public Profile Visit MrBaseball34's homepage! Find
can i solve I/O error 103 on the compiler. CCS Forum Index -> General CCS C Discussion View previous topic :: View next topic Author https://www.ccsinfo.com/forum/viewtopic.php?t=44479 Message juansebmxJoined: 17 Jan 2011Posts: 1 How can i solve I/O error 103 on the compiler. Posted: Mon Jan 17, 2011 11:44 am I Had a problem when i try to compile a http://www.delphigroups.info/2/6d/479235.html program, i already had try to compile the program with the other alternatives on the tab of compile, and it shows a window with the message of "I/O error 103". Can someone help me with error 103 this query, and thanks a lot for your commentaries related to this._________________Control, and Robotics. TtelmahJoined: 11 Mar 2010Posts: 10391 Posted: Mon Jan 17, 2011 3:26 pm I/O error, sounds odd. Are you sure you can write to the directories where the code is installed (the compiler needs to do this)?. In general the first thing to do, is to re-install the compiler, from a clean download, and try o error 103 a short one of the example programs. If this works, then move to your code. 'Error 103', normally means a numeric value is out of the allowed range (you get this if you try for example to use a switch statement with a value above 65535). Best Wishes PCM programmerJoined: 06 Sep 2003Posts: 19396 Posted: Mon Jan 17, 2011 3:59 pm It's a Delphi error code. CCS uses Delphi to write their Windows IDE program: http://www.ccsinfo.com/forum/viewtopic.php?t=36368 TtelmahJoined: 11 Mar 2010Posts: 10391 Posted: Tue Jan 18, 2011 3:02 am Which goes back to my thought about not being able to write to the directory. A Google on Delphi I/O error 103, suggests it is a common problem with networked drives. It also seems to happen if you have two copies of some programs open 'at once', with a semaphore then not being settable. Also, if the application was installed as 'super user', and then you try to run it, without write permissions. Best Wishes Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 YearOldest FirstNewest First CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours Page 1 of 1 Jump to:Select a forumSoftware----
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?? 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 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"