The Code Project View our advertisersUltimate Grid 5.0 for MFC - Now available!Advertise on the CodeProject
Home >> Files & Folders >> General

An email collection program
By Scott Wenger

This is a small program that can extract email addresses from files that are not necessarily text files. 
 VC5, MFC
 Posted 15 Jul 2001
 Updated 12 Aug 2001
Articles by this author
Send to a friend
Printer friendly version
FAQ
What's New
Lounge
Contribute
Message Boards
Broken links? Newsletter
 Email
 Password
Remember me?

MSDN Magazine - Your guide to Microsoft tools, development environments, and technologies for Windows and the Web.
Premium Sponsor
12 users have rated this article. result:
2.25 out of 5.

Sample Image - email_collect.gif

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.

About Scott Wenger

Scott Wenger
panther@coredcs.com

Click here to view Scott Wenger's online profile.

[Top] Sign in to vote for this article:     PoorExcellent  
MSDN Magazine - Your guide to Microsoft tools, development environments, and technologies for Windows and the Web.
Premium Sponsor

View our advertisersClick here for Dundas Consulting - experts in MFC, C++, TCP/IP and ASPAdvertise on the CodeProject
Hint: For a faster board use IE 4+, choose 'Use DHTML' from the View dropdown and hit 'Set Options'.
 Search (exact phrase)
 View   Per page   Messages since
New threadMsgs 1 to 3 of 3 (Total: 3)[First] [Prev] [Next] [Last]
Subject 
Author 
Date 
  loop unrolling
 carel 12:12 16 Jul '01 
  Bad link
 xlam 23:47 15 Jul '01 
  Re: Bad link
 Chris Maunder 0:41 16 Jul '01 
Last Visit: 12:00 Friday 1st January, 1999[First] [Prev] [Next] [Last]
Home >> Files & Folders >> General
Advertise on The Code Project
Article content copyright Scott Wenger, 2001
everything else © CodeProject, 1999-2001.

DevelopersDexDevGuruProgrammers HeavenTek-Tips ForumsTopXMLVisualBuilder.comW3SchoolsXMLPitstopZVONSearch all Partners