Search the Community
Showing results for tags 'files crlf'.
-
FOr a while now i've been running a script that uses a flat text file to keep track of users to perform actions on. I have some logic in the block that adds new users with some comma delimited fields with FileWriteLine and then updates that line with _FileWriteToLine this has been running fine for years but suddenly i'm having problems with the script crashing because when the very last line of the file is losing it's CRLF so the next appended line concatenates with the last line and the parser fails to parse the last line. this has been driving me nuts for a while so i finally took apart all my code and have discovered that for some reason _FileWriteToLine deletes CRLF off the bottom of the file after use. i don't know why this started suddenly, i even copied an old file.au3 library and it still does it (maybe a change to shell32.dll? ) I was able to replicate the bug by making a new file with each line having CRLF at the end then with the following code: #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_UseX64=y #AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** _FileWriteToLine($FilePath,12,"Test rewrite",1)After running the code and refreshing the file i can see that the last blank line disappears (no final CRLF) Is there a way to prevent this behavior? (without a huge logic rewrite to use a DB or another write method) EDIT: actually it seems that replacing the old au3 is working, or at least working some of the time. not sure if it's a *sometimes* bug with the older library.