#644 closed Feature Request (Rejected)
Can IniRead set @error for file/section/key not exist?
Reported by: | Rob Saunders <therks@…> | Owned by: | |
---|---|---|---|
Milestone: | Component: | AutoIt | |
Version: | Severity: | None | |
Keywords: | iniread @error default | Cc: |
Description
Is there any chance we could have IniRead set @error (or even @extended) when it has to resort to the default value?
Maybe something like:
Success: Returns the requested key value.
Failure: Returns the default string if requested key not found and sets @error.
@error 1 Filename invalid/does not exist 2 Section invalid/does not exist 3 Key invalid/does not exist
Attachments (0)
Change History (3)
comment:1 Changed 16 years ago by Valik
- Resolution set to Rejected
- Status changed from new to closed
comment:2 follow-up: ↓ 3 Changed 16 years ago by Rob Saunders <therks@…>
Oh I didn't realize the default value was a part of the API call. I thought that was something added to the IniRead function by you guys. Is the original API call "GetPrivateProfileString"? I'm just reading about it now.
And about testing if the key value existed, I was doing something like that, but I did a double check with random numbers. (Set random number, use that for default, if equal, set another random and do it again).
An extra question though, didn't you (Valik) say once that you wanted to rewrite the Ini functions from scratch to deal with some issues they had? If you ever do get the time or inclination to do that, do you think having @error reporting like this would make it in there?
comment:3 in reply to: ↑ 2 Changed 16 years ago by Valik
Replying to Rob Saunders <therks@…>:
Is the original API call "GetPrivateProfileString"? I'm just reading about it now.
It is.
An extra question though, didn't you (Valik) say once that you wanted to rewrite the Ini functions from scratch to deal with some issues they had?
See #15.
If you ever do get the time or inclination to do that, do you think having @error reporting like this would make it in there?
I do not know.
Guidelines for posting comments:
- You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
- In-depth discussions should take place on the forum.
For more information see the full version of the ticket guidelines here.
Nope. We would have to write code to handle each of those situations because the API does not provide any information about why the default string is being used. However, for 1 and 3 it's simple for you to write a wrapper function in AutoIt. Something like this is a start:
Probably the best way to handle the section names thing is just use IniReadSectionNames() and search the results array for the section name. No matter what, though, performance will suffer in testing for the section to exist.