欧美大屁股bbbbxxxx,狼人大香伊蕉国产www亚洲,男ji大巴进入女人的视频小说,男人把ji大巴放进女人免费视频,免费情侣作爱视频

歡迎來到入門教程網(wǎng)!

C語言

當前位置:主頁 > 軟件編程 > C語言 >

C語言按關鍵字搜索文件夾中文件的方法

來源:本站原創(chuàng)|時間:2020-01-10|欄目:C語言|點擊: 次

本文實例講述了C語言按關鍵字搜索文件夾中文件的方法。分享給大家供大家參考。具體實現(xiàn)方法如下:

方法1:

#include<iostream>
#include<string>
#include<io.h>
using namespace std;
void filesearch(string path,string mode)
{
  struct _finddata_t filefind;
  if(path[path.size()-1]=='\\')
    path.resize(path.size()-1);
  string curr=path+"\\*.*";
  int done=0,handle;
  if((handle=_findfirst(curr.c_str(),&filefind))==-1)
    return;
  while(!(done=_findnext(handle,&filefind)))
  {
    if(!strcmp(filefind.name,".."))
      continue;
    curr=path+"\\"+filefind.name;
    if(strstr(filefind.name,mode.c_str()))
      cout<<curr<<endl;
    if (_A_SUBDIR==filefind.attrib)
      filesearch(curr,mode);
  }  
  _findclose(handle);   
}
void main()
{
  string path,mode;
  cout<<"請輸入要搜的目錄"<<endl;
  cin>>path;
  cout<<"請輸出包含字符"<<endl;
  cin>>mode;
  filesearch(path,mode);
}

方法2:

#include<stdio.h>
#include<string.h>
#include<dir.h>
#define SIZE 12
void find_creat_file(char *);
int main(void)
{
 char filename[SIZE];
 strcpy(filename,"filename");
 find_creat_file(filename);
 getch();
 return 0;
}
void find_creat_file(char *filename)
{
 struct ffblk ffblk;
 int done;
 done=findfirst("d:\\filename",&ffblk,0);
 if(done==0)
 return 0;
 else
 mkdir("d:\\filename");
}

希望本文所述對大家的C語言程序設計有所幫助。

上一篇:C++實現(xiàn)當前時間動態(tài)顯示的方法

欄    目:C語言

下一篇:C++中關于委派(Delegates)的實現(xiàn)示例

本文標題:C語言按關鍵字搜索文件夾中文件的方法

本文地址:http://mengdiqiu.com.cn/a1/Cyuyan/2970.html

網(wǎng)頁制作CMS教程網(wǎng)絡編程軟件編程腳本語言數(shù)據(jù)庫服務器

如果侵犯了您的權(quán)利,請與我們聯(lián)系,我們將在24小時內(nèi)進行處理、任何非本站因素導致的法律后果,本站均不負任何責任。

聯(lián)系QQ:835971066 | 郵箱:835971066#qq.com(#換成@)

Copyright © 2002-2020 腳本教程網(wǎng) 版權(quán)所有