本文整理汇总了C++中CheckFile函数的典型用法代码示例。如果您正苦于以下问题:C++ CheckFile函数的具体用法?C++ CheckFile怎么用?C++ CheckFile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CheckFile函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CrossPlatformFilterCallback
pascal Boolean CrossPlatformFilterCallback (
AEDesc *theItem,
void *info,
void *callBackUD,
NavFilterModes filterMode
)
{
bool display = true;
OpenUserDataRecPtr data = (OpenUserDataRecPtr) callBackUD ;
if (filterMode == kNavFilteringBrowserList)
{
NavFileOrFolderInfo* theInfo = (NavFileOrFolderInfo*) info ;
if ( !theInfo->isFolder )
{
if (theItem->descriptorType == typeFSS )
{
FSSpec spec;
memcpy( &spec , *theItem->dataHandle , sizeof(FSSpec) ) ;
wxString file = wxMacMakeStringFromPascal( spec.name ) ;
display = CheckFile( file , theInfo->fileAndFolder.fileInfo.finderInfo.fdType , data ) ;
}
else if ( theItem->descriptorType == typeFSRef )
{
FSRef fsref ;
memcpy( &fsref , *theItem->dataHandle , sizeof(FSRef) ) ;
wxString file = wxMacFSRefToPath( &fsref ) ;
display = CheckFile( file , theInfo->fileAndFolder.fileInfo.finderInfo.fdType , data ) ;
}
}
}
return display;
}
示例2: snprintf
bool CSettings::FindConfig()
{
bool found = false;
char CheckDevice[12];
char CheckPath[300];
// Enumerate the devices supported by libogc.
for (int i = SD; (i < MAXDEVICES) && !found; ++i)
{
snprintf(CheckDevice, sizeof(CheckDevice), "%s:", DeviceName[i]);
if(!found)
{
// Check for the config file in the apps directory.
strlcpy(BootDevice, CheckDevice, sizeof(BootDevice));
snprintf(ConfigPath, sizeof(ConfigPath), "%s/apps/usbloader_gx/", BootDevice);
snprintf(CheckPath, sizeof(CheckPath), "%sGXGlobal.cfg", ConfigPath);
found = CheckFile(CheckPath);
}
if(!found)
{
// Check for the config file in the config directory.
strlcpy(BootDevice, CheckDevice, sizeof(BootDevice));
snprintf(ConfigPath, sizeof(ConfigPath), "%s/config/", BootDevice);
snprintf(CheckPath, sizeof(CheckPath), "%sGXGlobal.cfg", ConfigPath);
found = CheckFile(CheckPath);
}
}
FILE * testFp = NULL;
//! No existing config so try to find a place where we can write it too
for (int i = SD; (i < MAXDEVICES) && !found; ++i)
{
sprintf(CheckDevice, "%s:", DeviceName[i]);
if (!found)
{
// Check if we can write to the apps directory.
strlcpy(BootDevice, CheckDevice, sizeof(BootDevice));
snprintf(ConfigPath, sizeof(ConfigPath), "%s/apps/usbloader_gx/", BootDevice);
snprintf(CheckPath, sizeof(CheckPath), "%sGXGlobal.cfg", ConfigPath);
testFp = fopen(CheckPath, "wb");
found = (testFp != NULL);
if(testFp) fclose(testFp);
}
if (!found)
{
// Check if we can write to the config directory.
strlcpy(BootDevice, CheckDevice, sizeof(BootDevice));
snprintf(ConfigPath, sizeof(ConfigPath), "%s/config/", BootDevice);
CreateSubfolder(ConfigPath);
snprintf(CheckPath, sizeof(CheckPath), "%sGXGlobal.cfg", ConfigPath);
testFp = fopen(CheckPath, "wb");
found = (testFp != NULL);
if(testFp) fclose(testFp);
}
}
return found;
}
示例3: Exit
bool SjKaraokeMaster::Init(const wxString& musicFile, const wxString& artist, const wxString& title)
{
wxFSFile* fsFile;
// exit old stuff
Exit();
if( musicFile.StartsWith(wxT("http:")) // this may be a steam - in this case (or in others) we get into an endless loop
|| musicFile.StartsWith(wxT("https:"))
|| musicFile.StartsWith(wxT("ftp:")) )
return false;
// try to create CDG (try musicFile.cdg and musicFile.mp3.cdg)
if( (fsFile=CheckFile(musicFile, wxT("cdg"))) )
{
m_reader = new SjCdgReader(fsFile); // SjCdgReader takes ownership of fsFile!
return true; // success
}
// try to create LRC (Simple Lyrics)
if( (fsFile=CheckFile(musicFile, wxT("lrc"))) )
{
m_reader = new SjSyncTxtReader(fsFile, SJ_SYNCTXT_LRC, artist, title); // SjSyncTxtReader takes ownership of fsFile!
return true; // success
}
// no karaoke file available
return false;
}
示例4: CheckRecursivFiles
//----------------------------------------------------------------
void CheckRecursivFiles(DWORD iitem, char *remote_name, char *file, BOOL recursif)
{
//if the file exist
WIN32_FIND_DATA data, d0;
HANDLE hfind;
char tmp_path[LINE_SIZE]="",tmp_remote_name[LINE_SIZE];
if (file != NULL)
{
snprintf(tmp_path,LINE_SIZE,"%s\\%s",remote_name,file);
if (GetFileAttributes(tmp_path) != INVALID_FILE_ATTRIBUTES && scan_start)
{
//file exist + date
hfind = FindFirstFile(tmp_path, &d0);
if (hfind != INVALID_HANDLE_VALUE)
{
CheckFile(iitem, tmp_path, &d0, file);
FindClose(hfind);
}
}
if (tmp_path[strlen(tmp_path)-1] == '\\' || tmp_path[strlen(tmp_path)-1] == '/')
{
//if directory !
tmp_path[strlen(tmp_path)-1] = 0; // remove the ending /
CheckRecursivFiles(iitem, tmp_path, NULL, recursif);
}
}
//next
snprintf(tmp_path,LINE_SIZE,"%s\\*.*",remote_name);
hfind = FindFirstFile(tmp_path, &data);
if (hfind != INVALID_HANDLE_VALUE && scan_start)
{
do
{
if (data.cFileName[0] == '.' && (data.cFileName[1] == 0 || (data.cFileName[2] == 0 && data.cFileName[1] == '.'))){}
else
{
if (data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
{
if (recursif)
{
snprintf(tmp_remote_name,LINE_SIZE,"%s\\%s",remote_name,data.cFileName);
CheckRecursivFiles(iitem, tmp_remote_name, file, recursif);
}
}else
{
if (file == NULL)
{
snprintf(tmp_remote_name,LINE_SIZE,"%s\\%s",remote_name,data.cFileName);
CheckFile(iitem, tmp_remote_name, &data, "CURRENT DIRECORY CONTENT");
}
}
}
}while(FindNextFile(hfind, &data) != 0 && scan_start);
FindClose(hfind);
}
}
示例5: atoi
void CUCPDetail::OnUcpdApply()
{
CString tempstr;
m_ucpd_broker.GetWindowText(m_ucinfo->m_broker);
if (m_ucpd_service.GetCheck() == 0) {
m_ucinfo->m_service = false;
} else {
m_ucinfo->m_service = true;
}
m_ucinfo->m_appl_server = m_ucpd_appl_server.GetCurSel();
m_ucpd_broker_port.GetWindowText(m_ucinfo->m_broker_port);
m_ucpd_appl_server_shm_id.GetWindowText(m_ucinfo->m_appl_server_shm_id);
if (m_ucpd_auto_add_appl_server.GetCheck() == 0) {
m_ucinfo->m_auto_add_appl_server = false;
} else {
m_ucinfo->m_auto_add_appl_server = true;
}
m_ucpd_min_num_appl_server.GetWindowText(tempstr);
m_ucinfo->m_min_num_appl_server = atoi(LPCSTR(tempstr));
m_ucpd_max_num_appl_server.GetWindowText(tempstr);
m_ucinfo->m_max_num_appl_server = atoi(LPCSTR(tempstr));
m_ucpd_appl_server_max_size.GetWindowText(tempstr);
m_ucinfo->m_appl_server_max_size = atoi(LPCSTR(tempstr));
CheckFile(m_ucpd_log_dir, false);
m_ucpd_log_dir.GetWindowText(m_ucinfo->m_log_dir);
if (m_ucpd_log_backup.GetCheck() == 0) {
m_ucinfo->m_log_backup = false;
} else {
m_ucinfo->m_log_backup = true;
}
if (m_ucpd_sql_log.GetCheck() == 0) {
m_ucinfo->m_sql_log = false;
} else {
m_ucinfo->m_sql_log = true;
}
if (m_ucpd_access_log.GetCheck() == 0) {
m_ucinfo->m_access_log = false;
} else {
m_ucinfo->m_access_log = true;
}
if (m_ucpd_security.GetCheck() == 0) {
m_ucinfo->m_security = false;
} else {
m_ucinfo->m_security = true;
}
CheckFile(m_ucpd_access_list);
m_ucpd_access_list.GetWindowText(m_ucinfo->m_access_list);
CheckFile(m_ucpd_source_env);
m_ucpd_source_env.GetWindowText(m_ucinfo->m_source_env);
m_ucpd_time_to_kill.GetWindowText(m_ucinfo->m_time_to_kill);
m_ucpd_session_timeout.GetWindowText(m_ucinfo->m_session_timeout);
m_ucpd_job_queue_size.GetWindowText(m_ucinfo->m_job_queue_size);
CDialog::OnOK();
}
示例6: OllyPython_Init
BOOL OllyPython_Init(void)
{
char initfile[MAX_PATH];
char tmp[MAX_PATH+16];
BOOL result = 1;
if (initialized == 1)
{
return TRUE;
}
Addtolist(0, 0, "OllyPython");
result &= CheckFile("init.py");
result &= CheckFile("ollyapi.py");
result &= CheckFile("ollyutils.py");
if (!result)
{
Addtolist(0, -1, " Could not locate Python scripts");
return FALSE;
}
Py_Initialize();
if (!Py_IsInitialized())
{
Addtolist(0, -1, " Could not initialize Python");
return FALSE;
}
init_ollyapi();
GetModuleFileName(hinst, initfile, MAX_PATH);
PathRemoveFileSpec(initfile);
strncat(initfile, "\\python", 7);
snprintf(tmp, MAX_PATH+16, "OLLYPYTHON_PATH=\"%s\"", initfile);
PyRun_SimpleString(tmp);
strncat(initfile, "\\init.py", 8);
if (!ExecFile(initfile))
{
Addtolist(0, -1, " Could not run init.py");
return FALSE;
}
#ifdef ENABLE_PYTHON_PROFILING
PyEval_SetTrace(tracefunc, NULL);
#endif
initialized = 1;
return TRUE;
}
示例7: CheckFile
int CDataBase::CheckDB()
{
int res = CheckFile(DBFileSetting);
if (res != EGROKPRF_NOERROR)
return res;
if (PrivateFileExists())
res = CheckFile(DBFilePrivate);
return res;
}
示例8: check_file
static char *
check_file (const char *file)
{
char *full_file;
full_file = mystrdup (file);
if (CheckFile (full_file) == 0)
return full_file;
replace_envvar (&full_file);
if (CheckFile (full_file) == 0)
return full_file;
free (full_file);
return NULL;
}
示例9: TEST_FIXTURE
// ChecksumSHA1: Get(File &cFile)
TEST_FIXTURE(ConstructTest, ChecksumSHA1__Get_File__cFile_) {
// Check 'demotest.xml'
sChecksum = CheckFile(sumSHA1, "../Data/unitTestData/ChecksumTest_demo.xml");
CHECK_EQUAL("3225f273bb21d4252ac978da0d71fadb1e78eb7f", sChecksum.GetASCII());
// Check 'tokenizer.txt'
sChecksum = CheckFile(sumSHA1, "../Data/unitTestData/ChecksumTest_tokenizer.txt");
// [TODO] fails!
CHECK_EQUAL("b6f311adc109cfe58ec1156ad926260c725f3945", sChecksum.GetASCII());
// Check 'test.zip'
sChecksum = CheckFile(sumSHA1, "../Data/unitTestData/ChecksumTest_test.zip");
// [TODO] fails!
CHECK_EQUAL("1e531304afa05d60b5f9d1cd11b81cdbfae90947", sChecksum.GetASCII());
}
示例10: TEST_FIXTURE
// ChecksumMD5: Get(File &cFile)
TEST_FIXTURE(ConstructTest, ChecksumMD5__Get_File__cFile_) {
// Check 'demotest.xml'
sChecksum = CheckFile(sumMD5, "../Data/unitTestData/ChecksumTest_demo.xml");
CHECK_EQUAL("313a0294c72a84409c9dd6267d44730f", sChecksum.GetASCII());
// Check 'tokenizer.txt'
sChecksum = CheckFile(sumMD5, "../Data/unitTestData/ChecksumTest_tokenizer.txt");
// [TODO] fails!
CHECK_EQUAL("3ef605c74b399d7d869afb40de4cede4", sChecksum.GetASCII());
// Check 'test.zip'
sChecksum = CheckFile(sumMD5, "../Data/unitTestData/ChecksumTest_test.zip");
// [TODO] fails!
CHECK_EQUAL("898d399c87c96a6f73814b1940fbca16", sChecksum.GetASCII());
}
示例11: FilesTest
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
int FilesTest()
{
std::cout << "|- FilesTest -----------------" << std::endl;
int err = 0;
bool ok;
std::string testdir = MXAUnitTest::MXATempDir + MXAUnitTest::MXAFileSystemPathTest::TestDir;
CheckFile(MXAUnitTest::MXAFileSystemPathTest::OutputFile,
MXAUnitTest::MXAFileSystemPathTest::OutputFileName,
MXAUnitTest::MXAFileSystemPathTest::Extension);
std::string testFileName = ".hidden_file";
std::string testFilePath = testdir + MXAUnitTest::DirSeparator + testFileName;
std::string ext; // No Extension
CheckFile(testFilePath, testFileName, ext);
testFileName = "Normal.txt";
ok = MXADir::mkdir(testdir + MXAUnitTest::DirSeparator + "Dot.Dir" + MXAUnitTest::DirSeparator, true);
DREAM3D_REQUIRE_EQUAL(ok, true);
testFilePath = testdir + MXAUnitTest::DirSeparator + "Dot.Dir" + MXAUnitTest::DirSeparator + testFileName;
ext = "txt";
CheckFile(testFilePath, testFileName, ext);
ok = MXADir::rmdir(testdir + MXAUnitTest::DirSeparator + "Dot.Dir" + MXAUnitTest::DirSeparator, false);
DREAM3D_REQUIRE_EQUAL(ok, true);
testFileName = "No_Extension";
ok = MXADir::mkdir(testdir + MXAUnitTest::DirSeparator + "Dot.Dir" + MXAUnitTest::DirSeparator, true);
DREAM3D_REQUIRE_EQUAL(ok, true);
testFilePath = testdir + MXAUnitTest::DirSeparator + "Dot.Dir" + MXAUnitTest::DirSeparator + testFileName;
ext = "";
CheckFile(testFilePath, testFileName, ext);
ok = MXADir::rmdir(testdir + MXAUnitTest::DirSeparator + "Dot.Dir" + MXAUnitTest::DirSeparator, false);
DREAM3D_REQUIRE_EQUAL(ok, true);
testFileName = "EndsWithDot.";
ok = MXADir::mkdir(testdir + MXAUnitTest::DirSeparator + "Dot.Dir" + MXAUnitTest::DirSeparator, true);
DREAM3D_REQUIRE_EQUAL(ok, true);
testFilePath = testdir + MXAUnitTest::DirSeparator + "Dot.Dir" + MXAUnitTest::DirSeparator + testFileName;
ext = "";
CheckFile(testFilePath, testFileName, ext);
ok = MXADir::rmdir(testdir + MXAUnitTest::DirSeparator + "Dot.Dir" + MXAUnitTest::DirSeparator, false);
DREAM3D_REQUIRE_EQUAL(ok, true);
return err;
}
示例12: CreateDirectory
bool FileSystem::CreateDirectory(std::string dir) const
{
if (!CheckFile(dir))
return false;
FixSlashes(dir);
return fs.mkdir(dir);
}
示例13: GetFilesize
size_t FileSystem::GetFilesize(std::string file) const
{
if (!CheckFile(file))
return 0;
FixSlashes(file);
return fs.GetFilesize(file);
}
示例14: ofstream
std::ofstream* FileSystem::ofstream(std::string file, std::ios_base::openmode mode) const
{
if (!CheckFile(file))
return NULL;
FixSlashes(file);
return fs.ofstream(file, mode);
}
示例15: fopen
FILE* FileSystem::fopen(std::string file, const char* mode) const
{
if (!CheckFile(file) || !CheckMode(mode))
return NULL;
FixSlashes(file);
return fs.fopen(file, mode);
}