Academic Company Events Community Support Solutions Products & Services Contact NI MyNI
159 ratings:
 4.25 out of 5     Rate this Document

Difference between Carriage Return, Line Feed and End of Line Characters.



Primary Software:
Primary Software Version: 1.0
Primary Software Fixed Version: N/A
Secondary Software: Driver Software>>NI-VISA

Problem:
Putting a Carriage Return, Line Feed, or End of Line character in my strings in LabVIEW seems to all do the same thing.  What is the difference between these three characters?



Solution:
All three of these characters are ASCII representations for the end of the line.  In LabVIEW strings they all appear to have the functionality of the End of Line character (see below), however at the operating system level, they are each treated differently.

  The Carriage Return (CR) character (0x0D, \r) moves the cursor to the beginning of the line without advancing to the next line.  This character is used as a new line character in Commodore and Early Macintosh operating systems (OS-9 and earlier).

  The Line Feed (LF) character (0x0A, \n) moves the cursor down to the next line without returning to the beginning of the line.  This character is used as a new line character in UNIX based systems (Linux, Mac OSX, etc)

  The End of Line (EOL) character (0x0D0A, \r\n) is actually two ASCII characters and is a combination of the CR and LF characters.  It moves the cursor both down to the next line and to the beginning of that line.  This character is used as a new line character in most other non-Unix operating systems including Microsoft Windows, Symbian OS and others. 

Related Links:
KnowledgeBase 3VLAULIZ: Why Does My Serial Instrument Work in HyperTerminal But Not in LabVIEW or VISA Test Panels in MAX
KnowledgeBase 1749FBTR: Adding Termination Characters to a VISA Serial Write in LabVIEW

Attachments:





Report Date: 07/14/2009
Last Updated: 07/21/2009
Document ID: 4ZDEBNUV

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit