笔迹鉴别程序
考试的笔迹鉴别程序,分辨出不同人写的笔迹
This commit is contained in:
39
测试/本机测试/2-侯-算法/handwriting/getFiles.cpp
Normal file
39
测试/本机测试/2-侯-算法/handwriting/getFiles.cpp
Normal file
@@ -0,0 +1,39 @@
|
||||
/* 程序名:getFiles.c
|
||||
功能:返回一个文件夹下的所有文件名
|
||||
*/
|
||||
#pragma once
|
||||
#include<io.h>
|
||||
#include <stdio.h>
|
||||
#include<vector>
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
#include <string.h>
|
||||
|
||||
void getFiles(string path, vector<string>& files ){
|
||||
using namespace std;//引入整个名空间
|
||||
//文件句柄
|
||||
long hFile = 0;
|
||||
//文件信息
|
||||
struct _finddata_t fileinfo;
|
||||
string p;
|
||||
if((hFile = _findfirst(p.assign(path).append("/*").c_str(),&fileinfo)) != -1)
|
||||
{
|
||||
do
|
||||
{
|
||||
//如果是目录,迭代之
|
||||
|
||||
if((fileinfo.attrib & _A_SUBDIR))
|
||||
{
|
||||
if(strcmp(fileinfo.name,".") != 0 && strcmp(fileinfo.name,"..") != 0)
|
||||
getFiles( p.assign(path).append("/").append(fileinfo.name), files );
|
||||
} //如果不是,加入列表
|
||||
else
|
||||
{
|
||||
files.push_back(p.assign(path).append("/").append(fileinfo.name) );
|
||||
// cout<<fileinfo.name<<endl;
|
||||
}
|
||||
}while(_findnext(hFile, &fileinfo) == 0);
|
||||
|
||||
_findclose(hFile);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user