Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Does WriteLine() use a buffer?

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,50388
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Does WriteLine() use a buffer?
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Does WriteLine() use a buffer? - 8/6/2007 12:31:31 AM   
  RobertParker

 

Posts: 24
Score: 2
Joined: 6/8/2007
Status: offline
I have a subroutine in a script that generates a log file, and it is having some problems.  I was reviewing a directory of logs, and I found one that was very strange.  Half of the log is not written.  Some programming languages put the data to be written in a buffer before writing it to the disk, and if the program crashs the data in the buffer can be lost.  Here is an example with psuedo code.

output("line 1")
output("line 2")
output("line 3")
crash()

It looks like this code should output three lines before crashing, but sometimes it crashes with that data still in the buffer.  And the result is sometimes zero, one, two, or all three lines are displayed.

Can this sort of condition happen in vbscript?  This is the piece of code that is causing problems.  The last line that is being displayed in the log file is the script version.  This works 95% of the time.  Is this a buffer problem or an error in my code?


      

 
 
Post #: 1
 
 RE: Does WriteLine() use a buffer? - 8/6/2007 5:07:15 AM   
  ebgreen


Posts: 5034
Score: 31
Joined: 7/12/2005
Status: online
The answer is yes and no. The WSH does buffer the output, but if the engine dies unexpectedly, it does it's best to flush the buffer to the right place.

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to RobertParker)
 
 
Post #: 2
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Does WriteLine() use a buffer? Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts