Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: 10.1 Berlin IOResult for existing file


This question is answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 3 - Last Post: Oct 27, 2017 7:32 PM Last Post By: Remy Lebeau (Te... Threads: [ Previous | Next ]
Alan Jordan

Posts: 228
Registered: 3/2/01
10.1 Berlin IOResult for existing file  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 26, 2017 1:08 PM
What is the IOResult for an existing file?
if I use some code like this:
AssignFile(FileTyoe,FileName);
{$i-}
reset(FileType);
{$i+}
IORes:=IOResult;

What will be the value of IORes?
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: 10.1 Berlin IOResult for existing file  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 26, 2017 3:21 PM   in response to: Alan Jordan in response to: Alan Jordan
Alan Jordan wrote:

What is the IOResult for an existing file?

0 (if the file is successfully opened), since IOResult only reflects
I/O errors, and an existing file is not an error condition.

--
Remy Lebeau (TeamB)
Alan Jordan

Posts: 228
Registered: 3/2/01
Re: 10.1 Berlin IOResult for existing file  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 27, 2017 1:39 PM   in response to: Remy Lebeau (Te... in response to: Remy Lebeau (Te...
I am getting IOResult=5 which I find is access denied. What will cause this?
Remy Lebeau (TeamB) wrote:
Alan Jordan wrote:

What is the IOResult for an existing file?

0 (if the file is successfully opened), since IOResult only reflects
I/O errors, and an existing file is not an error condition.

--
Remy Lebeau (TeamB)
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: 10.1 Berlin IOResult for existing file  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 27, 2017 6:21 PM   in response to: Alan Jordan in response to: Alan Jordan
Alan Jordan wrote:

I am getting IOResult=5 which I find is access denied. What will
cause this?

Obviously, you don't have access to the file you are trying to open.
There are many reasons why access to a file could be denied. Maybe
the file is in use with sharing rights that don't allow you to open it the
way you are (actually, that would probably be error 32 instead). Maybe the file is (b)locked by an anti-virus. Maybe the file is owned by another user and not
accessible to the user that is running your app. Who knows. The
RTL (and the OS, for that matter) doesn't provide such fine grain detail for access denied errors.

--
Remy Lebeau (TeamB)
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02