<< Click to Display Table of Contents >> Navigation: 3. Script Language > Variable Definitions and Operations > Array -Commands > Array -Commands |
MiniRobotLanguage (MRL)
ARR.Pack Array to File Delimiter / ARR.pafd
Intention
The ARR.Pack Array to File Delimiter command, also known as ARR.pafd, is designed to pack the entire array into a file using a user-specified Delimiter.
This is useful for storing the state of an array for later use.
•Array Packing: The command packs the entire array specified by P1 into a file.
•File Storage: The packed array is stored in the file specified by P2, or in a temporary file if P2 is omitted.
•Array Copy/Backup: The Array can be unpacked using ARR.Unpack Array from File to the same or another Array-Number.
If you use another Array-Number you have effectively copied the Array.
Syntax
ARR.Pack Array to File Delimiter|P1|P2[|P3]
ARR.Pafd|P1|P2[|P3]
Parameter Explanation
•P1 - Array Number: Specifies the array number, which can range from 0 to 32.
•P2 - Delimiter-String Should be a String that itself will NOT occur in the Arrays.
•P3 - Filename (Optional): Specifies the filename where the packed array will be stored. If omitted, a temporary filename is generated in the ?exeloc\ directory.
After the operation the used file name is returned on TOS.
Example
'***********************************
' ARR.-Sample for packing an array into a file
'***********************************
ARR.Pack Array To Var
VAR.$$TXT=Hallo Peter und Paul!
ARR.Dim|0|10
' Delimiter
$$DEL=$crlf$
ARR.Set Array|0|1|Hello
ARR.Set|0|2|$$TXT
ARR.Set Array|0|10|$$TXT
ARR.pavd|0|$$DEL|$$VAA
LEN.$$VAA|$$LEN
DBP. Lenght of packed Array is: $$LEN
' We unpack it to Array Nr.1
ARR.Unpack Array From Var Delimiter|1|$$VAA|$$DEL
ARR.Get Array|1|1|$$TXA
MBX.$$TXA
ENR.
Remarks
-
Limitations:
-
See also:
•SDO.Arr----Small-Introduction-To-A
•Unpack-Array-from-File_Delimiter
•Unpack-Array-from-Var_Delimiiter