WIDTH is a C++ program which reports the length of the longest line in a file.
The computer code and data files described and made available on this web page are distributed under the GNU LGPL license.
WIDTH is available in a C++ version.
PAGES, a C++ program which reports the number of pages in a given file.
WRAP2, 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.