Special

Introducing the “Welcome to Xojo” Bundle!

New to Xojo and looking for guidance? We've put together a terrific bundle to welcome you! Xojo Bundle

This bundle includes six back issues of the magazine -- all of year 21 in printed book and digital formats -- plus a one-year subscription (beginning with 22.1) so you'll be learning all about Xojo for the next year. It's the perfect way to get started programming with Xojo. And you save as much as $35 over the non-bundle price!

This offer is only available for a limited time as supplies are limited, so hurry today and order this special bundle before the offer goes away!

Article Preview


Buy Now

Issue 6.4

COLUMN

The Finalizer

When Finally Is Not Enough

Issue: 6.4 (May/June 2008)
Author: Charles Yeomans
Author Bio: Charles is a senior software engineer at Dakim, Inc.
Article Description: No description available.
Article Length (in bytes): 6,446
Starting Page Number: 40
Article Number: 6415
Related Link(s): None

Excerpt of article text...

It is sometimes the case that a method needs to perform some task on exit, even if an exception is raised. For this, REALbasic has the Finally block. It suffices for most situations, but not all.

Deletion of temporary files is a standard example of the use of a Finally block. Temporary files created in standard locations should be deleted by the operating system from time to time - but suppose your code runs amok and creates too many files, or sucks up all available disk space. For reasons of security, an application might not want to leave temporary files containing sensitive information laying around. And it may be necessary to create temporary files in a location entirely under the control of the application to prevent substitution attacks.

So it is a good practice to delete temporary files when they are no longer needed. Let's begin with a naive example.

...End of Excerpt. Please purchase the magazine to read the full article.