Strings are limited to 255 characters. Here is a set of functions and function blocks for working with not limited text buffers. Text buffers are dynamically allocated or re-allocated.

attentionAttention

  • Text buffers management functions use safe dynamic memory allocation that needs to be configured in the project settings. From the project settings, press the "Advanced" push button and go to "Memory" tab. Here you can setup the memory for safe dynamic allocation.
  • There must be one instance of the TxbManager declared in your application for using these functions.
  • The application should take care of releasing memory allocated for each buffer. Allocating buffers without freing them will lead to memory leaks.

The application is responsible for freeing all allocated text buffers. However, all allocated buffers are automatically released when the application stops.

Memory management/Miscellaneous

TxbManager: Main gatherer of text buffer data in memory.

TxbLastError: Get detailed error report about last call.

Allocation/exchange with files

TxbNew: Allocate a new empty buffer.

TxbNewString: Allocate a new buffer initialized with string.

TxbFree: Release a text buffer.

TxbReadFile: Allocate a new buffer from file.

TxbWriteFile: Store a text buffer to file.

Data exchange

TxbGetLength: Get length of a text buffer.

TxbGetData: Store text contents to an array of characters.

TxbGetString: Store text contents to a string.

TxbSetData: Store an array of characters to a text buffer.

TxbSetString: Store string to text buffer.

TxbClear: Empty a text buffer.

TxbCopy: Copy a text buffer.

Sequential reading

TxbRewind: Rewind sequential reading.

TxbGetLine: Sequential read line by line.

Sequential writing

TxbAppend: Append variable value.

TxbAppendLine: Append a text line.

TxbAppendEol: Append end of line characters.

TxbAppendTxb: Append contents of another buffer.

TCP socket information - Text buffer

TxbRcvTCP: Store characters received from a TCP socket

TxbSendTCP: Sends characters of a text buffer to a valid TCP socket

UNICODE conversions

TxbAnsiToUtf8: Convert a text buffer to UNICODE.

TxbUtf8ToAnsi: Convert a text buffer to ANSI.

Text buffers manipulation

IEC 61131-3 Automation platform > Programming - Reference guide > Advanced operations > Text buffers manipulation

Previous chapterNext chapter


Created with the Personal Edition of HelpNDoc: Make Your PDFs More Secure with Encryption and Password Protection