EgtGeneral 1.4a5 : Aggiunto confronto tra file di testo. CScan -> Scanner.
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2013-2013
|
||||
//----------------------------------------------------------------------------
|
||||
// File : FileUtils.cpp Data : 11.12.13 Versione : 1.4a5
|
||||
// Contenuto : Funzioni di utilità sui file.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 11.12.13 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "\EgtDev\Include\EgnFileUtils.h"
|
||||
#include "\EgtDev\Include\EgnStringConverter.h"
|
||||
#include <io.h>
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
EraseFile( const string& sFile)
|
||||
{
|
||||
return ( ::DeleteFileW( stringtoW( sFile)) != 0) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
EmptyDirectory( const string& sDir)
|
||||
{
|
||||
wstring sDirW ;
|
||||
wstring sFileW ;
|
||||
_wfinddata_t c_file ;
|
||||
intptr_t hFile ;
|
||||
|
||||
|
||||
sDirW = stringtoW( sDir) ;
|
||||
sFileW = sDirW + L"\\*.*" ;
|
||||
|
||||
// ciclo su tutti i file del direttorio
|
||||
if ( ( hFile = _wfindfirst( sFileW.c_str(), &c_file)) != -1L) {
|
||||
do {
|
||||
if ( c_file.attrib != _A_SUBDIR) {
|
||||
sFileW = sDirW + L"\\" + c_file.name ;
|
||||
::DeleteFileW( sFileW.c_str()) ;
|
||||
}
|
||||
} while( _wfindnext( hFile, &c_file) == 0) ;
|
||||
_findclose( hFile) ;
|
||||
errno = 0 ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
Reference in New Issue
Block a user