Try...Finally question
From: Eddy Fontaine (eddy.remove.fontaine_at_pandora.remove.be)
Date: 01/05/05
- Next message: Rob Kennedy: "Re: Try...Finally question"
- Previous message: Rob Kennedy: "Re: Trying to use MemoryMappings but having a simple problem..."
- Next in thread: Rob Kennedy: "Re: Try...Finally question"
- Reply: Rob Kennedy: "Re: Try...Finally question"
- Reply: Bruce Roberts: "Re: Try...Finally question"
- Reply: Eddy Fontaine: "Re: Try...Finally question"
- Reply: VBDis: "Re: Try...Finally question"
- Reply: Jamie: "Re: Try...Finally question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 5 Jan 2005 18:13:32 +0100
Hi,
I am trying to avoid exception during file I/O by
using a try finally statement.
To avoid 'memory leak', i want to be sure that the file
will be closed, if it has been open by the program.
Should i write:
.
.
AssignFile(F,"MyFile.txt);
Reset(F);
Try
WriteLn(F,"This is my string");
Finally
CloseFile(F);
End;
.
Or should i write :
.
Try
AssignFile(F,"MyFile.txt);
Reset(F);
WriteLn(F,"This is my string");
Finally
CloseFile(F);
End;
.
.
In fact, wich is the statement that could cause an exception ?
Thanks for your help !
Eddy.
- Next message: Rob Kennedy: "Re: Try...Finally question"
- Previous message: Rob Kennedy: "Re: Trying to use MemoryMappings but having a simple problem..."
- Next in thread: Rob Kennedy: "Re: Try...Finally question"
- Reply: Rob Kennedy: "Re: Try...Finally question"
- Reply: Bruce Roberts: "Re: Try...Finally question"
- Reply: Eddy Fontaine: "Re: Try...Finally question"
- Reply: VBDis: "Re: Try...Finally question"
- Reply: Jamie: "Re: Try...Finally question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|