|
>Date: Mon, 28 Aug 2000 11:32:10 -0700 >From: Jim Langston <jlangston@conexfreight.com> > ... >At the end of every program there would be a call to cleanup the open files. >The cleanup would go through the open files and close them all. I remember >I had built a public array to contain the names of the open files. There >was another procedure that was actually called when any file was opened >that would add the name of the file to the bottom of the array and open >the file. The close procedure the would simply do a for...next loop and >close each of the open files until it got to a blank entry, at which point >it knew there were no more files open. (Or perhaps I had it go though >the entire array, I don't quite remember). > >This library was a convoluted thing with functions that called functions >that called functions. > ... Along the same lines, you could have a module in your application that handles cleanup. It would export a "register" procedure and a "cleanup" procedure. The "register" procedure has a parameter of a procedure pointer. It just adds this procedure pointer to an array. The "cleanup" procedure calls all the procedures in the array and clears the array. Any module that does something that might need to be cleaned up codes its own private (non-exported) cleanup procedure, and calls the "register" procedure passing a procedure pointer to its cleanup procedure. Barbara Morris +--- | This is the RPG/400 Mailing List! | To submit a new message, send your mail to RPG400-L@midrange.com. | To subscribe to this list send email to RPG400-L-SUB@midrange.com. | To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.