Month
Program Output Sample

Brief Information about the April 98 CSIG Meeting

Envelop Printing by Bruce Arnold


Leader: Bruce Arnold (b a r n o l d @ b l a s t . n e t)

Summary by: Ron Murawski (the_murs@pipeline.com)


User Group News

C/C++ User Group


The C/C++ User Group meets on the third Tuesday of every month. The April meeting began with a discussion of the Trenton Computer Festival (TCF) which occurred on the previous weekend. Members confessed to buying items such as a 56K modem and a 24x CD. TCF always offers tremendous bargains on computer equipment, especially at the fleamarket.

Bruce Arnold spent some time discussing the BeOS, a new operating system that runs on PCs. Bruce's first impression is that it seems small, fast and efficient. It also comes with a C compiler and Bruce promised a future report.

One member was programming in Windows and had trouble trying to launch a new window from a dialogue box. A knowledgeable member, James Carr, suggested that sub-classing the window in such a way as make it look like a control would solve the problem.

An interesting program was shown: A DOS program containing Win API calls to create a graphical window. The program displayed an attractive Mandelbrot plot. The C source code was included and was surprisingly small.

Bruce then moved on to the main presentation, a DOS program to address an envelope and print a bar code representing the zipcode. The program is notable for several features:

1. Direct control of a laser printer using PCL commands.

2. A "visual" version to display onscreen the envelope appearance.

Bruce essentially wrote two programs, one to send output to a laser printer and one to send output to a monitor. He used a compartmentalized approach so all common code resides in a common file. The bar coding conforms to US Postal Service regulations. The program is written in C in a straight-forward manner with helpful comments thoughout. You can get the source code and the executable programs from links on Bruce's C User Group home page: The source code and executables are avialable directly from the ACGNJ ftp server:

See SOURCE CODE links below.


//	envsubs.c	subroutines for envelope program.	B.Arnold
//
//	12-19-1993
//
//	This code is common to 'env.c' and 'etest.c'
//

//   The following routine takes the last line of the destination address
//   and attempts to find the zip code as the last token.  It does this by
//   reversing the line and looking for the first token.  The token (if
//   found) is then reversed back to its original order.  It is passed to
//   a validity checking routine to verify that it really is a zip code.
//   If all is OK, the barcode graphics routine is called. 


                                        //
void do_barcode(char *lastline)         // high level bar code parse routine 
    {                                   //
    char *p, *line;                               	// Note:  postal
    if (NULL == (line = strdup(lastline))) return;	// regulations also
    strrev(line);					// allow adding the
    p = strtok(line, ":;., \t\n\r");			// last 2 digits of
    if (p==NULL) return;				// the street address
    strrev(p);						// at the end of the
    if ( valid(p) ) barcode(p);				// zip code.  Ei.,
    free(p);						// 08809-103612
    }

"Random Access" questions start at 7:30 Tuesday night.

SOURCE CODE

Source Code Files

For help, email me at b a r n o l d @ b l a s t . n e t
Back to C++ Main Page