cr2crlf


cr2crlf, a C++ code which converts carriage returns to carriage returns + linefeeds.

I constantly run into problems, when transferring a file from one system to another, involving different conventions for ending a line of text.

It is my understanding that the following "conventions" apply:

While your file transfer code will usually transfer a text file in such a way that that carriage control is properly translated, this sometimes doesn't happen, especially if the text file is transferred "verbatim", that is, as though it were a binary file.

In such a case, cr2crlf() is the correct code to use if you want to convert a Macintosh (pre OSX) text file to a PC text file, since it will replace each occurrence of CR by CR+LF.

Usage:

cr2crlf old new
where

Licensing:

The information on this web page is distributed under the MIT license.

Languages:

cr2crlf is available in a C++ version.

Related Data and Programs:

cr2crlf_test

cr2lf, a C++ code which replaces all carriage returns by line feeds.

crrm, a C++ code which removes all carriage returns from a file.

deblank, a C++ code which makes a copy of a text file which contains no blank lines.

decomment, a C++ code which makes a copy of a text file which contains no "comment" lines (that begin with "#").

detroff, a C++ code which removes from a file every occurrence of the TROFF overprint pair character+backspace, which can make a MAN page printable;

filum, a C++ library which performs various operations on files.

lf2cr, a C++ code which replaces linefeeds by carriage returns.

lf2crlf, a C++ code which replaces all line feeds by carriage returns + line feeds.

lfrm, a C++ code which removes all linefeeds from a file.

reformat, a Fortran90 code which reads a text file that contains only real values, and writes a copy which has a fixed number of real values on each line.

reword, a C++ code which reads a text file and writes a copy which has a fixed number of "words" per line.

uncontrol, a C++ code which makes a copy of a text file which contains no control characters.

wrap, a C++ code which makes a copy of a text file in which no line is longer than a user-specified wrap length.

wrap2, a C++ code which wraps long lines in a text file, but which wraps some lines "early", so as to avoid breaking words.

Source Code:


Last revised on 16 December 2007.