Jump to content

Troubled with _FileReadToArray


Sodori
 Share

Go to solution Solved by Melba23,

Recommended Posts

I am trying to make a slave and a master system, however they are doing my head in!

Look at these two, for some reason, PrintaPC works with this line:

_FileReadToArray($file, $name, Default, ":")

But Mother does not! Reasons, that I can tell, is because PrintaPC had nothing yet in the questions and return. Giving me an error 3 and if I activate "$FRTA_INTARRAYS" as it desires, it leaves blank arrays. Can someone explain? This is beyond my comprehension!

Mother.txt

PrintaPC.txt

Link to comment
Share on other sites

  • Moderators
  • Solution

Sodari,

The Mother file has 2 trailing @CRLF - these are interpreted as lines which do not contain the delimiter and so the function fails as all lines do not have an equal number of parts. :)

You can test this using the $FRTA_INTARRAYS and looking at the arrays contained within the returned array:

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

Local $aLines

$sFile = @ScriptDir & "\Mother.txt"

_FileReadToArray($sFile, $aLines, $FRTA_INTARRAYS, ":")

_ArrayDisplay($aLines, "", Default, 8)    ; Returned array of arrays
_ArrayDisplay($aLines[0], "", Default, 8) ; Content of array within first element of returned array

$sFile = @ScriptDir & "\PrintaPC.txt"

_FileReadToArray($sFile, $aLines, Default, ":")

_ArrayDisplay($aLines, "", Default, 8)    ; Returned array as all lines have the delimiter
So you either have to remove the surplus @CRLF from the file or use the internal arrays. Please ask if you have any further questions. :)

M23

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:

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

 

Link to comment
Share on other sites

I do have another question, but I think you are not the one to answer that; How to remove gremlins from your bloody PC? >.< I did notice them at first, and removed them promptly!! And yet, here they are. But they are not in my Mother file... I don't know. Been such a long day it seems! Ty Melba, you old creature!

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
 Share

  • Recently Browsing   0 members

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