gxdir.cpp 408 B

1234567891011121314151617181920
  1. #include "std.h"
  2. #include "gxdir.h"
  3. gxDir::gxDir( HANDLE h,const WIN32_FIND_DATA &f ):handle(h),findData(f){
  4. }
  5. gxDir::~gxDir(){
  6. if( handle!=INVALID_HANDLE_VALUE ) FindClose( handle );
  7. }
  8. string gxDir::getNextFile(){
  9. if( handle==INVALID_HANDLE_VALUE ) return "";
  10. string t=findData.cFileName;
  11. if( !FindNextFile( handle,&findData ) ){
  12. FindClose( handle );
  13. handle=INVALID_HANDLE_VALUE;
  14. }
  15. return t;
  16. }