![]() |
Telelogic DOORS (steve huntington) | ![]() |
new topic :
profile :
search :
help :
dashboard :
calendar :
home
|
||
Latest News:
|
|
Topic Title: Strange Buffer behavior Topic Summary: Created On: 17-Jun-2005 20:03 Status: Post and Reply |
Linear : Threading : Single : Branch |
![]() |
![]()
|
![]() |
|
I have a basic loop ( for object in module do...
and a nested loop checking for links ( for thisLink in obj -> "*" do {
Everything works fine. But when I try to write some data to the buffer from the inner loop -- the buffer seems to get the data multiple times.
I am trying to capture data from the inner loop and later write out to a file at the proper location. If I print the buffered data (debug) at the spot where its collected everything seem OK. But the output file has 2, 3 sometimes more copies of the data printed.
I have been pulling my hair out for 2 days trying to figure this out. Please help..
I also tried with a string variable instead of a buffer but the results are the same..
|
|
![]() |
|
![]() |
|
I'm having trouble reading this due to the indentation and lack of declaring variables, such as out and buf. But I'm pretty sure you need a buf = "" statement before the link loop, otherwise buf just grows and grows.
Other comments: You don't need to have the double quotes after the out << buf statement. That inserts the contents of the buffer into the string table, which wastes memory and slow things down. Looks odd that you save the req start in the buffer but output the req close to the file, and then output the buffer. - Louie |
|
![]() |
|
![]() |
|
Thanks for your reply.
I do have a buf = "" to reset the buffer before the start of each inner loop. ( I removed that and some other things to make the example smaller)
The buffer collects a complete req start and close to output latter in the file.
|
|
![]() |
|
![]() |
|
Add your variable declarations and send the whole script.
|
|
![]() |
|
![]() |
|
Here are the variable declarations. I can't sent the whole script due to the attach code size limit of 2000 characters. Is there another way?
Edited: 17-Jun-2005 at 21:19 by Leonard Becraft |
|
![]() |
|
![]() |
|
![]() |
|
![]() |
|
The following is the script from your original posting with variable declarations added.
I have replaced the ouput steam with print statements to save time. I have added a buffer declaration inside the for object loop. I have also removed all the comments to reduce the size so the forum would accept it. Seems to work okay. I think this was a scope problem caused by autodeclare. I advise that you turn auto declare off on your client. This will ensure that all vriables are properly declared before use. This is the only way to ensure the correct scope of variables. ------------------------- Tony Goodman http://www.smartdxl.com Edited: 20-Jun-2005 at 11:39 by Tony Goodman |
|
![]() |
|
![]() |
|
Thanks your example help.
Creating and deleting the Buffer within the outer loop solved the problem.
Before I was creating a global Buffer and resetting to "" inside the outer loop giving me unpredictable results.
|
|
![]() |
Telelogic DOORS
» DXL Exchange
»
Strange Buffer behavior
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.