![]() |
Telelogic DOORS (steve huntington) | ![]() |
new topic :
profile :
search :
help :
dashboard :
calendar :
home
|
||
Latest News:
|
|
Topic Title: Closing streams Topic Summary: Created On: 15-Nov-2007 19:51 Status: Post and Reply |
Linear : Threading : Single : Branch |
![]() |
![]()
|
![]() |
|
Hello.
Is there a way to check if a stream has already been closed? I have a piece of code with some branches and it sometimes happens that I try to close a stream twice... I hope the question does not sound too stupid ![]() Andrea |
|
![]() |
|
![]() |
|
In every place its closed, assign the Stream handle to null after closing it. Then, also around each place its closed, check if the handle to the stream is null before closing it. Also when you first declare the Stream, assign it to null.
------------------------- David Pechacek AAI Services Textron dpechacek@sc-aaicorp.com David.Pechacek@gmail.com |
|
![]() |
|
![]() |
|
Thanks David
|
|
![]() |
|
![]() |
|
Ignore Pechacek's sound, sensible, and resonable response, demonstrating proper software practices. But if you don't ignore it, then consider writing and using the function attached.
I think you could surround your 'close(s)' commands with 'noError' and 'lastError' commands: noError() close(s) lastError() // Ignore close errors My solution may perhaps be better to bandaid an existing script, but Pechacek's is obviously better. - Louie |
|
![]() |
|
![]() |
|
Yeah adding a function that cuts down on lines of code and lowers the amount of repetitive code is probably better.
Way to refactor my answer Lou. ![]() ------------------------- David Pechacek AAI Services Textron dpechacek@sc-aaicorp.com David.Pechacek@gmail.com Edited: 19-Nov-2007 at 15:31 by David Pechacek |
|
![]() |
Telelogic DOORS
» DXL Exchange
»
Closing streams
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.