I have a function something like this:
{**********************************************************************}
function WriteIniHeader(const Filename:TFilename; strT:string):boolean;
var
INI:TIniFile;
begin
Result:=true;
INI:=TIniFile.Create(Filename);
try
try
with INI do
begin
WriteString('Application','Program',strT);
...
end
except
Result:=false
end
finally
INI.Free;
WritePrivateProfileString(nil,nil,nil,pchar(Filename));
end;
end;
{**********************************************************************}
If I give it a filename on a floppy disk I get back false if there is
no floppy in the drive. If there is a floppy in the drive I always get
back true, even if the disk is write protected. So I'm looking for a
way to determine the success of the write process. Should I do this
with a read back right after the write or is that going to just check
against the drive's buffer? Maybe reopen the file after the
WritePrivateProfileString procedure? And is the try...except blocking
really necessary here?
Comments?
----- Original Message -----
From: "Rob Kennedy" <[EMAIL PROTECTED]>
To: "Delphi-Talk Discussion List" <[email protected]>
Sent: Sunday, September 11, 2005 11:44 PM
Subject: Re: Disk is Writeable
> PAV wrote:
> > How do I determine if a disk is writeable?
>
> A sure-fire way to do that is to try writing to it. If you get no
> errors, then the part of the disk you tried writing to was writable at
> the time you tried.
>
> --
> Rob
> __________________________________________________
> Delphi-Talk mailing list -> [email protected]
> http://www.elists.org/mailman/listinfo/delphi-talk
>
>
__________________________________________________
Delphi-Talk mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi-talk