| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 593 人关注过本帖
标题:求助:关于文件中提取邮件的算法
只看楼主 加入收藏
crosoli
Rank: 1
等 级:新手上路
帖 子:57
专家分:0
注 册:2007-4-24
收藏
 问题点数:0 回复次数:1 
求助:关于文件中提取邮件的算法
关于文件中提取邮件老鸟门能不能给个思路或者算法,小弟谢谢了
搜索更多相关主题的帖子: 算法 邮件 文件 
2008-05-11 20:48
crosoli
Rank: 1
等 级:新手上路
帖 子:57
专家分:0
注 册:2007-4-24
收藏
得分:0 
void CEAPDlg::BrowseDir(CString strDir)
{
    CString flagstr(" \"<>\r\n[]{}:;=,'?#!`^$*%()");
    int bufsize = m_list.GetCount();
    CString *Word = new CString [bufsize];
    for(int i=0;i<bufsize;i++)
    {
        m_list.GetText(i,Word[i]);
    }
    
    CFileFind finder;
    CString szDir = strDir;
    
    if(szDir.Right(1) != "\\")
        szDir += "\\";

    szDir += "*.*";
    
    BOOL res = finder.FindFile(szDir);
    while( res )
    {
        res = finder.FindNextFile();
        if(finder.IsDirectory() && !finder.IsDots())
        {
            CString strPath = finder.GetFilePath();
            CString strFileName = finder.GetFileName();
            BrowseDir( strPath );
        }
        else if(!finder.IsDirectory() && !finder.IsDots())
        {
            CString strFileName = finder.GetFileName();
            CString strFilePathName = finder.GetFilePath();
            CString name = strFileName.Right(4);
            if((name.Find(".eml") != -1) ||
                (name.Find(".txt") != -1) ||
                (name.Find(".dbx") != -1) )
            {
                CFile file;
                if(!file.Open(strFilePathName,CFile::modeRead)) continue;
                CString fstring = "";
                char *readbuf ;
                readbuf = fstring.GetBuffer(file.GetLength());
                file.Read(readbuf ,file.GetLength());
                file.Close();
                fstring = readbuf;
                CString s1 = "",s2 = "",s3 = "",s4 = "";
                
                int pos1=0,pos2=0,pos3=0,pos4=0;
                while((pos1 = fstring.Find("@")) != -1)
                {
                    s1 = fstring.Left(pos1);
                    fstring.Delete(0,pos1+1);
                    s1.MakeReverse();
                    if((pos2=s1.FindOneOf(flagstr)) != -1)
                    {
                        s2 = s1.Left(pos2);
                        s2.MakeReverse();
                    }
                    if((pos3=fstring.FindOneOf(flagstr)) != -1)
                    {
                        s3 = fstring.Left(pos3);
                    }
                    if(s2!="" && (s3.Find(".")!=-1))
                    {
                        s4 = s2 + "@" + s3;
                        m_list.AddString(s4);
                    }
                }
            }
        }
    }
    finder.Close();
    delete []Word;
}


这有个算法,老鸟门怎么不出来帮忙哦,我想知道正则表达式要怎么写呀,帮帮忙呀
2008-05-12 03:29
快速回复:求助:关于文件中提取邮件的算法
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.023069 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved