当前位置:首页
开发技术指南» 文章正文
    引言:
 

 

    摘要: 使用 webrequest req=webrequest.create (this.url); webresponse res=req.getresponse (); streamreader sr=new streamreader(res.getresponsestream),encoding.ascii); 获得代码文件,但由于按ascii,无法正确显示中文! 不知道如何解决,请教各位......
 ·求一个sql语句的写法(100分)    »显示摘要«
    摘要: 有一个字符型变量a=12.0,13.00,156.000,2315 现要得到数值:12.0 13.00 156.000 2315 请问如何用 sql 写一通用语句 ,100 ......


如何实现对硬盘的搜索

如何遍历各个硬盘以及文件夹实现对指定文件的查找?

NO.1   作者: tolixiaohui

CString   strFolder;                 //用户数据所在文件夹  
  char   chOldFolder[200];  
  GetCurrentDirectory(200,   chOldFolder);  
  strFolder   =   (CString)chOldFolder;  
   
  WIN32_FIND_DATA   FindData;  
  HANDLE   hFile   =   FindFirstFile(_TEXT("*.mdb"),   &FindData);  
  if(INVALID_HANDLE_VALUE   !=   hFile)  
  {  
  //do   what   you   want   to   do    
  return   TRUE;  
  }  
  BOOL   FindOK   =   (INVALID_HANDLE_VALUE   !=   hFile);  
  while(FindOK)  
  {  
  FindOK   =   FindNextFile(hFile,   &FindData);  
  if(FindOK)  
  {  
                //do   what   you   want   to   do    
                                  return   TRUE;  
  }  
  }  
  FindClose(hFile);  
 

NO.2   作者: fireseed

 
  void   CCDListView::FindApeFile(   CString   strPath   )  
  {  
  WIN32_FIND_DATA   FindFileData;  
  //   开始查找第一个文件  
  HANDLE   hff   =   FindFirstFile(   CString(strPath   +   "*.*"   ).GetBuffer(),   &FindFileData   );  
  if   (   INVALID_HANDLE_VALUE   ==   hff   )  
  {  
  if   (   ERROR_FILE_NOT_FOUND   ==   GetLastError()   )  
  {  
  return;  
  }  
  }  
  do  
  {  
  if   (   !strcmp(   FindFileData.cFileName,   "."   )   ||   !strcmp(   FindFileData.cFileName,   ".."   )   )  
  {  
  continue;  
  }  
  //   如果是子目录则递归查找  
  if   (   FILE_ATTRIBUTE_DIRECTORY   &   FindFileData.dwFileAttributes   )  
  {  
  FindApeFile(   strPath   +   FindFileData.cFileName   +   "\\"   );  
  continue;  
  }  
  //   比较文件扩展名  
  string   TempExt(   FindFileData.cFileName   );  
  size_t   n   =   TempExt.find_last_of(   .   );  
  if   (   n   <=   0   ||   n   >=   TempExt.length()   )  
  {  
  continue;  
  }  
  if   (   0   ==   m_strFind.CompareNoCase(   TempExt.substr(   n   ).c_str()   )   )  
  {  
  //   匹配文件找到,调用回调函数  
  if   (   FALSE   ==   FindFileProc(   strPath   +   FindFileData.cFileName   )   )  
  {  
  break;  
  }  
  }  
  }   while(   FindNextFile(   hff,   &FindFileData   )   );  
  FindClose(   hff   );  
  }  
 


 ·javascript的小问题    »显示摘要«
    摘要: <a href="javascript:;" target="_top" onclick="mm_nbgroup(down,navbar1,layout_r12_c1,images/layout_r12_c1_f3.jpg,1);" onmouseover="mm_nbgroup(over,layout_r12_c......
» 本期热门文章:

©2000-2007 All Rights Reserved. 最佳浏览:1024X768 MSIE