Right-To-Left Unicode Strings; Reading And Writing To Files; Send Strings To A User Interface - AMX NETLINX PROGRAMMING LANGUAGE Manual

Programming language
Table of Contents

Advertisement

NetLinx UniCode Functions

Reading and Writing to Files

The NetLinx Unicode library supports reading and writing of WIDECHAR arrays. The WC_FILE
routines operate the same as the FILE routines with the exception of FILE_OPEN. WC_FILE_OPEN
takes an additional parameter; the file format.
The WC_FILE_OPEN returns a special file handle so it is important to only use the file handle returned
by WC_FILE_OPEN with other WC_FILE functions and the file handle used with WC_FILE functions
must have been obtained by calling WC_FILE_OPEN.
The NetLinx Unicode library supports three different file formats for compatibility with files created on
a computer. Windows Notepad supports the same three file formats so files created in Notepad can be
read using the WC_FILE routines and files created using the WC_FILE routines can be read with
Notepad.
When reading or appending to file, the file format is automatically determined when the file is opened.
You can pass in a variable to WC_FILE_OPEN and the function will set the variable to the file format
that was detected. When writing files, the file format parameter will determine how data is written to the
file. The following constants can be used for specifying or checking the file format:
WC_FORMAT_UNICODE, WC_FORMAT_UNICODE_BE,
WC_FORMAT_UTF8. The Unicode file format, specified by the constant WC_FORMAT_UNICODE,
is the fastest to encode and decode. You should use this format unless you have a particular application
that requires either UTF-8 or Unicode BE encoding.
The WC_FILE_READ/WRITE functions take the number of characters that will be read or written to
the file. However, the functions return the number of bytes read or written to the file, not the number of
characters. For Unicode and Unicode BE encoding, there are 2 bytes for every character. For UTF-8
encoding, the number of bytes for every character varies depending on the character.
Unicode filenames are not supported. The parameter for the file name is a CHAR array. Always use a
non-Unicode name for the file.
The following file functions support WIDECHAR arrays:

Send strings to a User Interface

Sending a WIDECHAR array to a user interface is accomplished using WC_TP_ENCODE.
WC_TP_ENCODE takes a WIDECHAR array and returns a CHAR array formatted for a user interface
UNI or BAU command.
cMyString = WC_TP_ENCODE(wcMyString)
SEND_COMMAND dvTP,"'^UNI-1,0,',cMyString "

Right-to-Left Unicode Strings

Right-to-Left Unicode languages are stored in memory the same way left-to-right language are. The first
memory position of an array contains the first logical character. You can access the right-most character
of a Right-to-Left Unicode string using this notation:
wchChar = wcString[1]
186
WC_FILE_OPEN
WC_FILE_CLOSE
WC_FILE_READ
WC_FILE_READ_LINE
WC_FILE_WRITE
WC_FILE_WRITE_LINE
NetLinx Programming Language Reference Guide

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Netlinx studio 2

Table of Contents