Search Contact information
University of Cambridge Home Department of Engineering
University of Cambridge >  Engineering Department >  computing help

End-of-line characters in text files

Suppose in an editor you open a new file, type A, press the Enter key, then type BC and save as raw ASCII. What's in the file and how big will the file be? The answer depends on the type of machine you're using. Usually -

These differences don't cause trouble until you copy files between different types of machines. Even then you might well not have trouble because programs that use text-files are aware of the differences. If you're programming at a low level however, you may need to take care.

Note also that some programs expect the final line of a file to end with an EOF token. C++ include files, for example, should end with an EOF token.

Converting

See also

Wikipedia's Newline page offers more detail and history.

© Cambridge University Engineering Dept
Information provided by Tim Love (tpl)
Last updated: June 2007