Search::Search()
{
}
void Search::Start( const char *  strMailDir)
{
 BOOL ans;
 CFileFind find;
 CString strMailRoot;
 strMailRoot.Format("D:\\SoShare_Server\\*.*");
 ans = find.FindFile(strMailRoot);
 while(ans)
 {
  ans = find.FindNextFile();
  if((find.IsDirectory() == TRUE) && (find.IsDots() != TRUE))
  {
   CString strRecvMobile = find.GetFileName();
   if(strRecvMobile.GetLength() != 11)
   {
    continue;
   }
   CString strSourcePath,strDestPath;
   strSourcePath.Format("D:\\SoShare_pubMail\\%s\\%s.html",strMailDir,strMailDir);
   strDestPath.Format("D:\\SoShare_Server\\%s\\%s\\%s.html",strRecvMobile,strMailDir,strMailDir);
   CString strNewMailDir;
   strNewMailDir.Format("D:\\SoShare_Server\\%s\\%s",strRecvMobile,strMailDir);
   CreateDirectory(strNewMailDir,NULL);
   if (CopyFile(strSourcePath,strDestPath,FALSE))
   {
    ModifyHtmlContent(strDestPath,strRecvMobile); 
   }
  }
 }
 find.Close();
 return;
}
Search::~Search()

}
void Search::ModifyHtmlContent( const char * pszFileName, const char* pszRecvMobile )
{
 int fp;
 fp = _open( pszFileName , _O_RDWR );
 int i = 1 ;
 if( fp == NULL )
  return;
 
 char c;
 while( !_eof(fp) )
 {
  _read( fp, &c, 1 ) ;
  if(c=='\n')
  {
   i++;
   if( i == 4 )
   {
    
    int a = _write( fp, pszRecvMobile , 11 );
    _close(fp) ;
    return;
   }
   continue;
  }
 }
 _close(fp) ;
 
}