API関数でファイル操作
なんかこんなもん作ってみました。
#include#include #include using namespace std; void SerchFiles( const string& stDirectryName ) { string st = stDirectryName + "\\*.*"; WIN32_FIND_DATA ffd; ::ZeroMemory( &ffd, sizeof( WIN32_FIND_DATA ) ); HANDLE hnd = ::FindFirstFile( st.c_str(), &ffd ); if( hnd == INVALID_HANDLE_VALUE ){ return; } WIN32_FIND_DATA ffd2; ::ZeroMemory( &ffd2, sizeof( WIN32_FIND_DATA ) ); while( ::FindNextFile( hnd, &ffd2 ) ){ string NewName = stDirectryName + '\\' + ffd2.cFileName; if( ffd2.dwFileAttributes == FILE_ATTRIBUTE_DIRECTORY ){ if( ffd2.cFileName[0] != '.' ){ SerchFiles( NewName ); } }else{ cout << NewName << endl; } } return; } int main( int argc, char* argv[] ) { if( argc == 2 ){ SerchFiles( string( argv[1] ) ); } return 0; } コマンドライン引数に c: とか入れるととってもステキなことが起こるかも。 しかしこの程度のプログラムを書くのに3時間もかかるとは・・・・まだまだだな。