Barcodes
Code 3 of 9 Barcodes
I acquired the Code 3 of 9 algorithm from Ed Rickman at the Research Triangle Institute in 1991 while I was working for Computer Sciences Corporation under contract to the U.S. EPA on a project to redesign the database for the Radon Measurement Proficiency (RMP) Program. CSC and EPA used it to barcode mailing labels for participants in the program.
The source code was developed as C++, but it is really just plain old C. There’s nothing object-oriented about it.
Feel free to take the C/C++ code and modify it to suit your needs. That’s what I did with the Pascal code that Ed gave me.
File | Description |
---|---|
barcode.zip | Zipped file containing the source code |
code39.h | Header file for the Code 3 of 9 functions |
text39.h | Header file for digitized text functions |
hpbar.h | Header file for printing barcodes on a PCL® printer |
code39.cpp | C++ source for encoding text strings as Code 3 of 9 barcodes |
text39.cpp | C++ source code for encoding text strings in a bit-mapped font, which can be combined with a Code 3 of 9 barcode |
hpbar.cpp | C++ source code for displaying barcodes (with text) on a PCL printer |
By the way, the original postal barcodes (POSTNET) are even simpler than Code39. (There are only 10 characters.) If you like mathematical and logical puzzles, and you don’t already know the encoding algorithm for POSTNET, try figuring it out just by looking at several examples (if you can still find them).