Nubie

is this bug in _FileReadToArray ?

4 posts in this topic

I found when try detect "//" symbol

#include <file.au3>
Local $aRecords
_FileReadToArray("test.txt",$aRecords)
_ArrayDisplay($aRecords, "")

Then it showed

SYjvo8K.png

Btw, is possible for detect symbols "//" stay before other charaters ?

Share this post


Link to post
Share on other sites



Nubie,

Works fine when I try it: :)

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

$sFileName = "Test.txt"

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

Local $aRecords

_FileReadToArray("test.txt",$aRecords)

_ArrayDisplay($aRecords, "")

$sText = FileRead($sFileName)

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

FileDelete($sFileName
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. ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

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

 

Share this post


Link to post
Share on other sites

Yes you're right. Maybe it's bug with notepad. Don't know why I have it. Thanks!

ofhTMCz.png

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

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)

FileClose($file)

(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.

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