Jump to content

Recommended Posts

Posted (edited)

Guys,

my script adds new line to the text file after inserting an array. How can I prevent that?

_FileWriteFromArray(@ScriptDir & '\WatchList.txt', $OldSymbols)

Or the only way to fix that is to remove the "@CRLF" afterwards?

 

Thank you

Edited by toto22
Posted (edited)

@toto22

Taking a look at the _FileWriteFromArray() function, seems that the @CRLF is always added at the end of the file, both for one dimensional and two dimensional array:

FileWrite($hFile, $a_Array[$x] & @CRLF)
FileWrite($hFile, $s_Temp & @CRLF)

 

Edited by FrancescoDiMuro

Click here to see my signature:

Spoiler

ALWAYS GOOD TO READ:

 

Posted

@toto22

Pay attention :)

The @CRLF is not added to your array, but it is added during the process of writing your array in the file by the _FileWriteFromArray() function; so, regardless your prior "managing" of the array, the @CRLF would be added indipendently.

You could remove the @CRLF after using _FileWriteFromArray(), or use another function like FileWrite() in a loop, using @CRLF for each line except the last one.

You can find for both the two "ways" to do that, a tons of examples on the Forum :)

 

Click here to see my signature:

Spoiler

ALWAYS GOOD TO READ:

 

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
×
×
  • Create New...