Jump to content

is this bug in _FileReadToArray ?

Recommended Posts

  • Moderators


Works fine when I try it: :)

#include <File.au3>
#include <Array.au3>

$sFileName = "Test.txt"

FileWrite($sFileName, "       //aaaaaaa" & @CRLF & "dfgdfgdfg")

Local $aRecords


_ArrayDisplay($aRecords, "")

$sText = FileRead($sFileName)

MsgBox($MB_SYSTEMMODAL, "Content", $sText)

I think your file has some non-printing characters which are creating another linebreak. Try looking at the file in Hex and see if you can see anything - or post it here so we can take a look. ;)


Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:


ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area


Link to comment
Share on other sites

Not a bug. It is a linefeed character, ascii char number 10 (or 0A in hex). In AutoIt, this is denoted by @LF. Windows Notepad only recognizes Windows newlines, which consist of both a carriage return (ascii char 13, 0D in hex, @CR in AutoIt) and a line feed.

Consider this example:

$file = FileOpen("c:\temp\file.txt", 2)

FileWrite($file, "A" & @CR & "B" & @CR)
FileWrite($file, @CRLF & @CRLF)

FileWrite($file, "A" & @LF & "B" & @LF)
FileWrite($file, @CRLF & @CRLF)

FileWrite($file, "A" & @CRLF & "B" & @CRLF)
FileWrite($file, @CRLF & @CRLF)


(note: will overwrite c:temptest.txt!)

Then look at the file in notepad.exe and notice that only the last AB are on separate lines. (/edit: and check in notepad++ what it actually looks like.)

So not a bug. Well, not really, depends how you look at it I guess. It's just how notepad.exe has worked forever and it's a major PITA for people who try to mix unix/linux and windows textfiles... And it's clearly considered a "wontfix" by Microsoft.

Edited by SadBunny

Roses are FF0000, violets are 0000FF... All my base are belong to you.

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

  • Recently Browsing   0 members

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