Jump to content
Sign in to follow this  
slam666

Problem with FileWriteLine

Recommended Posts

slam666

Hi,

I have a script that add text to a file, the problem I have is the text I put in the file is not writen to the file directly, it seem that Autoit use a buffer and after x number of bytes it write the content to the file. Is there any way to force the buffer to flush to the file?

I open the file then my script do stuff, write text in the file, do stuff etc. If I check the file when the script is running I dont see all the text that the script put into it, if I close the script then the rest of the text in the file gets there.

Thanks.

Share this post


Link to post
Share on other sites
MSLx Fanboy

A filehandle can only read or write. If you do not use a filehandle however, fwrites should take place immediately


Writing AutoIt scripts since
_DateAdd("d", -2, _NowCalcDate())

Share this post


Link to post
Share on other sites
slam666

So if I use a filehandle for write it does write immediately. And there is no way to force it to write immediately? I know that filehandle is faster because it does not open the file each time so I would like to use handle if possible but I need a way to force the buffer to flush.

A filehandle can only read or write.  If you do not use a filehandle however, fwrites should take place immediately

<{POST_SNAPBACK}>

Share this post


Link to post
Share on other sites
MSLx Fanboy

I don't work too much with files, except for data logging of Run() commands...

The only way I can think of forcing a handle to push text to the file is to close the handle...

If you're not writing too much to the file, I wouldn't see using filenames as a problem, else you might want to see if using multiple handles to the same file would work...i've never tried that...but you never know


Writing AutoIt scripts since
_DateAdd("d", -2, _NowCalcDate())

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  

×