613-518-1166 info@zimdatabases.com

Developing ZIM Applications

Hex Codes in Character Literals

< All Topics

If you need a place a character not normally available from the keyboard into a character literal, use the backslash to create the hex code for that character as shown in the following example:

‘This string has an ASCII escape generated by hex 1B (1B)’

The two characters immediately following a quoted backslash are treated as hex code provided they are either digits from 0 to 9 or letters from A (a) to F (f).

Any character string containing a hex code must be enclosed in quotation marks.

Note: The escape function of the backslash inside quoted character strings can be switched off with a SET ESCAPECHAR command.

Example

Character literals that include hex codes can be useful for sending control codes to printers and terminals. For example, if the ASCII codes SI (hex 0F) and DC2 (hex 12) are used, respectively, to select and cancel condensed printing on your particular printer, use the following sequence of statements to print a report in the condensed mode:

set output printer   % switch serial output to printer
output ‘F’;        % switch condensed print on
…. commands to generate report ….
output ’12’         % switch condensed print off
set output terminal  % switch output back to terminal

Was this article helpful?
0 out Of 5 Stars
5 Stars 0%
4 Stars 0%
3 Stars 0%
2 Stars 0%
1 Stars 0%
How can we improve this article?
Table of Contents