#include #include void main ( int argc, char *argv[] ); /******************************************************************************/ void main ( int argc, char *argv[] ) { /******************************************************************************/ /* Purpose: CR2LF replaces carriage returns by line feeds. Discussion: This simple-minded program reads each character in a text file, and replaces every carriage return character by a line feed character. Note that the output of GETCHAR is an INT, and not a CHAR, and we need to honor this so that we can catch EOF, which is equal to -1. Sample usage: cr2lf < infile > outfile Modified: 07 August 2001 Author: John Burkardt */ int c; while ( ( c = getchar ( ) ) != EOF ) { if ( c == '\r' ) { putchar ( '\n' ); } else { putchar ( c ); } } }