[AccessD] difference between linefeed and carriage return

Gustav Brock Gustav at cactus.dk
Sun Dec 10 02:38:45 CST 2006


Hi Susan

Further to Bruce's explanation, note that the sequence always must be CR+LF in the DOS and Windows world. That means Chr(13) & Chr(10) which can be hard to remember even if you use the constant vbCrLf. And in SQL the constant cannot be used, so you have to learn.

To simplify things, MS introduced the "clear language" constant vbNewLine which in Windows equals vbCrLf but is easier to remember.

What complicates matters is that the Unix and Linux world uses only a LF for a new line while the old Mac OS used CR only. This means that a text file created in Unix or an old Mac may - when viewed in Windows - not display as intended.

More fun here:

  http://en.wikipedia.org/wiki/Newline

/gustav

>>> bhjohnson at verizon.net 10-12-2006 06:26 >>>
They are literally holdovers from the typewriter days when the carriage
holding the paper moved back and forth in front of the keys.

As you typed, it moved one space at a time from right to left (on Western
typewriters). When you got to the end of a line (judge by eye),  you had a
big lever on the left side of the carriage which you'd push to the right.
This moved the paper up one line (could be adjusted on most typewriters to
1, 1.5 or 2 lines) and pushed the carriage back to the left where the next
line started.

Especially earlier mainframe (were there any other kind?) printers copied
the mechanism. A line feed -- chr$(10) -- moved the paper up one line. The
next character to print would be one space to the right of the last one only
one line below.

The carriage return -- chr$(13) -- moved the head or print position to the
left margin; just like the typewriter did.

Most PC systems usually could care less what terminates the lines in a
text/data file. By convention, it's both a line feed and carriage return.
Visual Basic/VBA even have constants for them; vbCrLf and wdCrLf.

Mainframes frequently use only one character as a line terminator. Depends
on the flavor.

HTH

Bruce H. Johnson
Sylmar, CA
-----Original Message-----
From: accessd-bounces at databaseadvisors.com 
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Susan Harkins
Sent: Saturday, December 09, 2006 3:05 PM
To: 'Access Developers discussion and problem solving'
Subject: [AccessD] difference between linefeed and carriage return

I can't really tell the difference between a linefeed and a carriage return
-- I'm sure there is one. Can someone explain the differences between them?
 
Susan H. 





More information about the AccessD mailing list