Programming
102
NetLinx Studio (v2.4 or higher)
fTemperature = 98.652
cMyString = FORMAT('The current temperature is %3.2f',fTemperature)
------------------------------------------------------------------------
fTemperature = 98.652
cTempString = FORMAT('%3.2f',fTemperature)
wcMyString = _WC('The current temperature is ')
wcMyString = WC_CONCAT_STRING(wcMyString,CH_TO_WC(cTempString))
Unicode - 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:
WC_FILE_OPEN
WC_FILE_CLOSE
WC_FILE_READ
WC_FILE_READ_LINE
WC_FILE_WRITE
WC_FILE_WRITE_LINE
Unicode - 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 "
Содержание NETLINX STUDIO V2.4
Страница 1: ...instruction manual Software NetLinx Studio v2 4 or higher ...
Страница 16: ...NetLinx Studio v2 4 or higher 4 NetLinx Studio v2 4 or higher ...
Страница 32: ...The NetLinx Studio v2 4 Work Area 20 NetLinx Studio v2 4 or higher ...
Страница 44: ...Working With Workspace Files 32 NetLinx Studio v2 4 or higher ...
Страница 88: ...Working With Systems and System Files 76 NetLinx Studio v2 4 or higher ...
Страница 118: ...Programming 106 NetLinx Studio v2 4 or higher ...
Страница 152: ...Working With Online Devices 140 NetLinx Studio v2 4 or higher ...
Страница 199: ...Index 187 NetLinx Studio v2 4 or higher ...