Backslash ('\') Codes Display
- Updated2026-05-29
- 3 minute(s) read
Backslash mode instructs LabVIEW to interpret characters that immediately follow a backslash (\) as a code for non-displayable characters. Use this mode to debug VIs and to send non-displayable characters to instruments, serial ports, and other devices.
To use backslash codes display, right-click a string constant, control, or indicator and select '\' Codes Display.
Table 10. Backslash Code Interpretation in LabVIEW shows how LabVIEW interprets these codes.
| Code | LabVIEW Interpretation |
|---|---|
| \00 through \FF | Hex value of an 8-bit character; must be uppercase |
| \b | Backspace (ASCII BS, equivalent to \08) |
| \f | Form feed (ASCII FF, equivalent to \0C) |
| \n | Linefeed (ASCII LF, equivalent to \0A). The Format Into File function automatically converts this code into the platform-dependent end-of-line character. |
| \r | Carriage return (ASCII CR, equivalent to \0D) |
| \t | Tab (ASCII HT, equivalent to \09) |
| \s | Space (equivalent to \20) |
| \\ | Backslash (ASCII \, equivalent to \5C) |
- Use uppercase letters for hexadecimal characters.
- Use lowercase letters for special characters, such as form feed and backspace.
The case of characters influences how LabVIEW interprets strings in backslash codes display. For example:
| Situation | Example String Sequence | LabVIEW Interpretation |
|---|---|---|
| Valid backslash hex code | \BFare | hex BF followed by the word are |
| Valid backslash code for non-displayable character |
|
|
| Invalid hex character follows backslash | \Bfare | \B is not the backspace code, and \Bf is not a
valid hex code. Where a backslash is followed by only part of a valid hex character, LabVIEW assumes a 0 follows the backslash. As a result, LabVIEW interprets \B as hex 0B. Any time an invalid hex character follows a backslash, LabVIEW ignores the backslash character. |
You can enter some non-displayable characters listed in Table 10. Backslash Code Interpretation in LabVIEW from the keyboard, such as a carriage return, into a string control regardless of whether you select '\' Codes Display. However, if you enable backslash mode when the display window contains text, LabVIEW redraws the display to show the backslash representation of any non-displayable characters and the \ character itself.
Indicators behave the same way as controls.
Understanding Backslash Codes Display
Experiment with backslash codes display to understand how LabVIEW interprets string data in this display style.
To understand how '\' Codes Display handles string data with example strings, complete the following steps.
-
Add a string control to the front panel window.
The default mode is Normal Display.
-
Resize the string control to display multiple lines of text and
enter the following string:
LEFT \RIGHT\3F
-
Right-click the string control and select '\' Codes
Display.
The string appears as follows because the carriage return after LEFT and the backslash characters around RIGHT are shown in backslash form:
LEFT\n\\RIGHT\\3F
- Repeat step 1 to add a new string control to the front panel window.
- Right-click the new string control and select '\' Codes Display.
-
Resize the string control to display multiple lines of text and
enter the following string:
LEFT \RIGHT\3F
-
Right-click the string control and select Normal
Display.
The string appears as follows because LabVIEW originally interpreted \r as a carriage return and now prints one. \3F is the ASCII representation of the question mark (?).
LEFT RIGHT?
-
Right-click the string control again and select '\' Codes
Display.
The string appears as follows:
LEFT\nRIGHT?