An email collection program





5.00/5 (2 votes)
Jul 15, 2001
1 min read

69106

917
This is a small program that can extract email addresses from files that are not necessarily text files.
Introduction
This is a small program that can extract email addresses from files that are not necessarily text files.
The program works by opening the input file as a binary file. If an '@' sign is found in the file, the program "backs up" in the file to find the first character that could not be a valid email character.
Then, the email address is collected and stored in an array which is placed in memory. This process continues until the end of file is reached.
When the entire input file is read, the addresses are sorted in alphabetical order, and duplicate addresses are removed. Email addresses that are found in the file are shown in an edit box.
Additionally, a text file containing the same list is created (called emails.txt) in the root directory.
All enhancements and modifications are left to the creativity and imagination of the progrmamer.
Note: This program demonstrates the use of a very efficient sort algorithm. Also, this program shows beginning programmers how to allocate and free memory. Other items of potential interest show file positioning and removal of duplicate entries.
History
12 Aug 2001 - I incorporated a suggestion from a codeproject member, fixed a few bugs, and then made many improvements to the program. The program now can collect up to 250,000 email addresses per file.