LF2CR is a C++ program which converts line feeds to carriage returns.
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 program 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, LF2CR is the correct program to use if you want to convert a UNIX text file to a pre OSX Macintosh text file, since it will replace each occurrence of LF by CR.
lf2cr old newwhere
The computer code and data files described and made available on this web page are distributed under the GNU LGPL license.
LF2CR is available in a C++ version.
CR2CRLF, a C++ program which replaces carriage returns by carriage returns + line feeds.
CR2LF, a C++ program which replaces carriage returns by line feeds.
CRRM, a C++ program which removes all carriage returns from a file.
DEBLANK, a C++ program which makes a copy of a text file which contains no blank lines.
DECOMMENT, a C++ program which makes a copy of a text file which contains no "comment" lines (that begin with "#").
DETROFF, a C++ program 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.
LF2CRLF, a C++ program which replaces linefeeds by carriage returns + line feeds.
LFRM, a C++ program which removes all linefeeds from a file.
REFORMAT, a FORTRAN90 program 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++ program which reads a text file and writes a copy which has a fixed number of "words" per line.
UNCONTROL, a C++ program which makes a copy of a text file which contains no control characters.
WRAP, a C++ program which makes a copy of a text file in which no line is longer than a user-specified wrap length.
WRAP2 is a C++ program which wraps long lines in a text file, but which wraps some lines "early", so as to avoid breaking words.
You can go up one level to the C++ source codes.