Delphi and Kylix

Moderators: pritaeas
Number of threads: 7264
Number of posts: 19073

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Preventing "Can't write" error Posted by LordBug on 26 Mar 2006 at 10:28 PM
In a little program I knocked up, I'm using ini files. When the program closes, it saves some things to the ini file.

By accident, I found that when the program is on an unwritable medium (eg CD), it comes back with an error message along the lines of "Cannot write to INI file", which keeps on coming back, no matter how many times you press OK. The only way I could kill it in the end was to use ProcessExplorer (Not even TaskManager worked).

Can someone suggest to me how I'd get around this error, and replace it with my own (Which would be a single message of "Unable to save settings" and then the program finishes closing)

Cheers
Report
Re: Preventing "Can't write" error Posted by softman on 26 Mar 2006 at 11:12 PM
: In a little program I knocked up, I'm using ini files. When the program closes, it saves some things to the ini file.
:
: By accident, I found that when the program is on an unwritable medium (eg CD), it comes back with an error message along the lines of "Cannot write to INI file", which keeps on coming back, no matter how many times you press OK. The only way I could kill it in the end was to use ProcessExplorer (Not even TaskManager worked).
:
: Can someone suggest to me how I'd get around this error, and replace it with my own (Which would be a single message of "Unable to save settings" and then the program finishes closing)
:
: Cheers
:
Hi!

The file writing part is in try /except block? If it is not, try using it for handling the above exception by yourself.

Bye
\\///
/O O\
| | |
| _ |
\___/
SoftMan

Report
Re: Preventing "Can't write" error Posted by porodoro on 27 Mar 2006 at 7:52 AM
: : In a little program I knocked up, I'm using ini files. When the program closes, it saves some things to the ini file.
: :
: : By accident, I found that when the program is on an unwritable medium (eg CD), it comes back with an error message along the lines of "Cannot write to INI file", which keeps on coming back, no matter how many times you press OK. The only way I could kill it in the end was to use ProcessExplorer (Not even TaskManager worked).
: :
: : Can someone suggest to me how I'd get around this error, and replace it with my own (Which would be a single message of "Unable to save settings" and then the program finishes closing)
: :
: : Cheers
: :
: Hi!
:
: The file writing part is in try /except block? If it is not, try using it for handling the above exception by yourself.
:
: Bye
: \\///
: /O O\
: | | |
: | _ |
: \___/
: SoftMan
:
:
Yes i think it is. I've used it many times.

try
your code..

except
application.terminate or leave it empty
end;




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.