recomment, a C++ code which converts C style comments to C++ style comments.
Recall that C style comments begin (anywhere) with the marker /* and end (anywhere) with the marker */. C++ comments begin anywhere with the string // and continue to the end of the current line.
This code incorporates suggestions and coding provided on 28 April 2005 by Steven Martin of JDS Uniphase, Melbourne Florida. These suggestions allow the code to ignore the internal contents of strings, (which might otherwise seem to begin or end comments), to handle lines of code with trailing comments, and to handle comments with trailing bits of code.
Warning: a number of operating systems pretend to honor the difference between capital and lowercase letters but for various reasons of "convenience" do not actually do a proper job. My current complaint is about Macintosh OSX; when you set up your hard drive, you have one chance to choose whether it is "case sensitive" or not. After that, you can't change the option without wiping the disk. A consequence is that, although you can name a file "fred.c" or "Fred.C" and see the letters in the case you chose, at certain points, the operating system makes no distinction between upper and lower case. In particular, it is common to use "fred.c" to denote a C file and "fred.C" to denote a C++ file. On a Macintosh OSX system without strict case sensitivity, this means that a disaster will occur should you issue the command
recomment fred.c fred.CAs far as the operating system is concerned, you have asked it to read and write using the same file. And so...it doesn't create the output file, and it overwrites the input file...yes, it's gone! For this reason, the code has been modified to refuse to accept an output file which is identical to the input file except for case.
recomment old.c new.cwhere
The information on this web page is distributed under the MIT license.
recomment is available in a C++ version.
c_comment, a Fortran90 code which makes a copy of a file in which C++ style comments have been replaced by C-style comments.
cr2lf, a C++ code which reads a text file and replaces carriage returns by line feeds.
crrm, a C++ code which reads a text file and removes carriage returns.
deblank, a C++ code which makes a copy of a text file which contains no blank lines.
decomment, a C++ code which removes every comment line (beginning with a "#") from a file.
filum, a C++ library which performs various operations on files.
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 wraps some lines "early", so as to avoid breaking words.