Jump to content

_filereadtoarray including linefeeds

Recommended Posts

I'm using _fileradtoarray to parse a simple text file I created. When reading the file into an array, it's clearly recognizing each new line by the carriage return character, but it's also adding this character to each array value. How do I prevent this from happening?

You can recreate this effect by creating a file in Notepad called c:\test.txt with several lines of [Enter] delimited text. Then run this script and you can see that the array value gets the carriage return added:

#include <file.au3>

Dim $array

If Not _FileReadToArray("c:\test.txt",$array) Then

MsgBox(4096,"Error", " Error reading file:" & @error)



While 1

If WinActive("Untitled - Notepad") Then

ControlClick("Untitled - Notepad", "", 15)





Link to post
Share on other sites

I'm using _fileradtoarray to parse a simple text file I created

when you create this .txt file can you use

FileWrite ( filehandle or "filename", "line" )


filehandle The handle of a file, as returned by a previous call to FileOpen. Alternatively, you may use a string filename as the first parameter.

line The line of text to write to the text file. The line is written as is - no @CR or @LF characters are added. ****** important part ***

hope it helps


Link to post
Share on other sites

I suppose that's the answer... I was hoping to use an array for simplicity's sake, but it looks as if that filereadarray function is just too limited for my needs.

Edited by gordo
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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...