Sign in to follow this  
Followers 0
jterwelp

FileWriteLine Buffer Behavior

6 posts in this topic

Short of using a FileOpen() and FileClose() before and after each FileWriteLine(), is there any way to get around the FileWriteLine() buffer behavior? It seems to buffer 8KB of data (or multiples thereof) before it actually commits it to the file.

I have an AutoIt 3.2.0.1 script which writes to a log file. If the PC is rebooted while the script is running, none of the lines that I attempted to write using FileWriteLine() appear in the log file. Please let me know if posting a sample script to illustrate this behavior would be helpful.

Thanks,

Jeff

Share this post


Link to post
Share on other sites



Hi,

what are you trying to accomplish? What is the problem to solve?

So long,

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

what are you trying to accomplish? What is the problem to solve?

When I call FileWriteLine(), I want the data to appear in the log file immediately without having to close and reopen the file each time I write another line.

Jeff

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

When I call FileWriteLine(), I want the data to appear in the log file immediately without having to close and reopen the file each time I write another line.

Jeff

Use FileWriteLine() without opening and closing the file ...

Just specify the filename in the the function and the rest will be taken care of.

:whistle:

Edited by JdeB

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Just specify the filename in the the function and the rest will be taken care of.

I believe that using a filename with FileWriteLine() is functionally equivalent to using a file handle with a FileOpen() and FileClose() but, you're right, this approach will definitely make my code cleaner. I generally try to avoid using a filename with FileWriteLine() but it may be the best solution in this case. Thank you for the idea.

Jeff

Share this post


Link to post
Share on other sites

I believe that using a filename with FileWriteLine() is functionally equivalent to using a file handle with a FileOpen() and FileClose() but, you're right, this approach will definitely make my code cleaner. I generally try to avoid using a filename with FileWriteLine() but it may be the best solution in this case. Thank you for the idea.

Jeff

Correct...The only way you can assure that the information is actually written is to close the file ...


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0