KB-48239: Retrieving the number of characters in a .TXT file.

Question:

How can the number of characters in a .TXT file be retrieved?

Solution:

To do so, there are two possibilities (both via scripts):

1st: TxtFile = ReadFromFile(“Address_File.txt”)
    Number_of_Characters = Len(TxtFile)

2nd:  Number_of_Characters = GetFileSize(“Address_File.txt”)

Notes:

  • Len function returns the number of characters in the string, while GetFileSize function returns the number of bytes in the file. However, since Elipse SCADA reads files in ANSI, every character corresponds to byte, so both functions will return the same value.
  • Len function is limited: in larger files (i.e., larger than 65533 characters), this function returns the maximum value (65533), ignoring the other characters. This does not happen with GetFileSize function.
Print Friendly, PDF & Email

Este artigo foi útil? Was this helpful?

Classificação média - Average rating 0 / 5. Count: 0

Leave a Reply

Your email address will not be published.Required fields are marked *