Software Projects - C++ Programs
C 2 HTML
- C 2 HTML Source
- All project files: ftp://ftp.timstyles.me.uk/www/c2html.zip
- Win32 executable: ftp://ftp.timstyles.me.uk/www/c2html.exe
C 2 HTML is a very simple command line program to convert C or C++ source code into an html formatted document. By default the program uses <B> tags for keywords, to make them bold; <I> tags for comments, to put them in italics; and <U> tags for strings, to underline them. This gives standard formatting for code in black and white. If the text is highlighted and copied into a plain text editor, the formatting will be lost and the result will be identical to the original source code.
The style sheet code.css is used if it exists, and this can redefine the tags to change the colour of the text instead of the style. The code.css sheet I use for the code on this site is here. The program can be used from a terminal or command line, or by dragging and dropping the source file onto the program in Windows. If the program is run with no arguments, it will ask for the filename of the source code to be converted.
The program steps through the file, placing tags around keywords, strings and comments. It replaces HTML symbols (such as < and &) with the HTML code for the character (e.g < and &), and it replaces all spaces with &apm;nbsp; to maintain indents exactly. Tabs are replaced with 3 spaces. A fixed pitch font should be used, and this can be specified in the code.css style sheet (see my example).
Split and Rejoin
- Split and Rejoin Source
- All project files: ftp://ftp.timstyles.me.uk/www/sarj.zip
- Win32 executable: ftp://ftp.timstyles.me.uk/www/sarj.exe
Split and Rejoin is a Windows application, written using Microsoft Foundation Classes (MFC), to break up files into smaller files of a given size. The same program is used to rejoin the smaller files to recreate the original file. Files are passed into the program by dragging and dropping them into the dialog.
A large file is split by dragging and dropping it onto the program dialog, which then provides two edit boxes to set the name of the part files and set the maximum size of a part file. The split button is then pressed and the progress bar will show the progress of the splitting. Part files will have the given name followed by (n of m).srj where n is the part number and m is the total number of parts. The part files are rejoined by dragging and dropping them one at a time onto the program dialog, which will specify any remaining parts to be dragged and dropped. Once all the parts have been dropped onto the dialog, an edit box will appear with the original name of the complete file, which can be modified. The rejoin button is then pressed and the progress bar will show the progress of the rejoining.
During splitting the program writes out the part files one at a time. Each part file starts with a header, which identifies is as a split and rejoin file. It gives the number of the part and the total number of parts, and also the original large file name, so that the parts cannot be mixed up. A fixed amount of data is read in repeatedly from the large file (4Mb or the amount required to complete the part file) and this is copied directly to the part file being written. When the parts are rejoined, a list of the required parts is made first. Once all the parts have been provided, it steps through them reading in a fixed amount of data repeatedly and copying it directly to the large file being created.
The program uses MFC objects and so can only be compiled with the Microsoft Visual C++ Compiler. The functions.cpp and constants.h source files are provided separately as these contain all the functions necessary to split and rejoin files. They exchange information with the dialog class, and so cannot be compiled on their own without re-implementation.