Jump to content

FileWriteLine Buffer Behavior


jterwelp
 Share

Recommended Posts

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

Link to comment
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

Link to comment
Share on other sites

  • Developers

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

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
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

Link to comment
Share on other sites

  • Developers

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 ...

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...