当前位置: 首页>>代码示例>>C++>>正文


C++ DeleteFileA函数代码示例

本文整理汇总了C++中DeleteFileA函数的典型用法代码示例。如果您正苦于以下问题:C++ DeleteFileA函数的具体用法?C++ DeleteFileA怎么用?C++ DeleteFileA使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了DeleteFileA函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: DeleteFileA

bool NFile::remove( Path filename )
{
#ifdef CAESARIA_PLATFORM_WIN
  BOOL result = DeleteFileA( filename.toString().c_str() );
  if( !result )
  {
    int error = GetLastError();
    //Logger::warning( "Error[%d] on removed file %s", error, filename.toString().c_str() );
  }
  return result;
#elif defined(CAESARIA_PLATFORM_UNIX) || defined(CAESARIA_PLATFORM_HAIKU)
  int result = ::remove( filename.toString().c_str() );
  return (result == 0);
#endif
}
开发者ID:KSLcom,项目名称:caesaria-game,代码行数:15,代码来源:file.cpp

示例2: CleanUp

void CleanUp(HANDLE hFile)
{
    if (CloseHandle(hFile) != TRUE)
    {
        Fail("GetFileSizeEx: ERROR -> Unable to close file \"%s\".\n"
             " Error is %d\n", 
            szTextFile, GetLastError());
    }
    if (!DeleteFileA(szTextFile))
    {
        Fail("GetFileSizeEx: ERROR -> Unable to delete file \"%s\".\n"
             " Error is %d\n", 
            szTextFile, GetLastError());
    }
}
开发者ID:0-wiz-0,项目名称:coreclr,代码行数:15,代码来源:GetFileSizeEx.cpp

示例3: poco_assert

void FileImpl::removeImpl()
{
	poco_assert (!_path.empty());

	if (isDirectoryImpl())
	{
		if (RemoveDirectoryA(_path.c_str()) == 0) 
			handleLastErrorImpl(_path);
	}
	else
	{
		if (DeleteFileA(_path.c_str()) == 0)
			handleLastErrorImpl(_path);
	}
}
开发者ID:119,项目名称:vdc,代码行数:15,代码来源:File_WIN32.cpp

示例4: main

int main(int argc, char *argv[]) {
	if (argc != 2 || stricmp(INSTALL_COMMAND, argv[1]) != 0 && stricmp(UNINSTALL_COMMAND, argv[1]) != 0) {
		MessageBoxA(NULL, "Usage:\n  drvsetup install - install driver\n  drvsetup uninstall - uninstall driver\n", "Information", MB_OK | MB_ICONINFORMATION);
		return 1;
	}
	if (stricmp(UNINSTALL_COMMAND, argv[1]) == 0) {
		UnregisterDriver();
		char sysRoot[MAX_PATH];
		char pathName[MAX_PATH];
		GetEnvironmentVariableA("SYSTEMROOT", sysRoot, MAX_PATH);
		strncpy(pathName, sysRoot, MAX_PATH);
		strncat(pathName, "/SYSTEM32/mt32emu.dll", MAX_PATH);
		if (!DeleteFileA(pathName)) {
			// Driver can't be deleted, register pending deletion
			MoveFileExA(pathName, NULL, MOVEFILE_DELAY_UNTIL_REBOOT);
		}
		return 0;
	}
	char sysRoot[MAX_PATH];
	char pathName[MAX_PATH];
	char oldName[MAX_PATH];
	GetEnvironmentVariableA("SYSTEMROOT", sysRoot, MAX_PATH);
	strncpy(pathName, sysRoot, MAX_PATH);
	strncat(pathName, "/SYSTEM32/mt32emu.dll", MAX_PATH);
	strncpy(oldName, sysRoot, MAX_PATH);
	strncat(oldName, "/SYSTEM32/mt32emu.old", MAX_PATH);
	DeleteFileA(oldName);
	MoveFileA(pathName, oldName);
	int setupPathLen = strrchr(argv[0], '\\') - argv[0];
	strncpy(oldName, argv[0], setupPathLen);
	oldName[setupPathLen] = 0;
	strncat(oldName, "/mt32emu.dll", MAX_PATH);
	CopyFileA(oldName, pathName, FALSE);
	RegisterDriver();
	return 0;
}
开发者ID:belaamg,项目名称:munt,代码行数:36,代码来源:mt32emu_win32drv_setup.cpp

示例5: cleanup_pid_file

static void cleanup_pid_file()
{
        string pidfile = PID_FILE;
#if defined(OS_WINDOWS_MOBILE) || defined(OS_WINDOWS_VISTA)
	wchar_t *wpidfile = strtowstr_alloc(pidfile.c_str());
	if (wpidfile) {
		DeleteFile(wpidfile);
		free(wpidfile);
	}
#elif defined(OS_WINDOWS)
	DeleteFileA(pidfile.c_str());
#else
	unlink(pidfile.c_str());
#endif
}
开发者ID:zeeshanabid94,项目名称:ENCODERS,代码行数:15,代码来源:main.cpp

示例6: DeleteFileA

// Removes object from disk and memory
bool Cleaner::RemoveFile(QString filepath)
{

	// use client0::RemoveFile
	return DeleteFileA(filepath.toAscii().constData());

// 	if(removed)
// 	{
// 		WorkLog::GetLog().printmain(QString("object was successfully removed: ") + filepath);
// 	} else 
// 	{
// 		WorkLog::GetLog().printmain(QString("warning! Object was not removed: ") + filepath);
// 	}

}
开发者ID:burluckij,项目名称:unhooker,代码行数:16,代码来源:cleaner.cpp

示例7: DeleteFileUTF8

BOOL DeleteFileUTF8(LPCTSTR path)
{
  if (WDL_HasUTF8(path) && GetVersion()< 0x80000000)
  {
    MBTOWIDE(wbuf,path);
    if (wbuf_ok)
    {
      BOOL rv=DeleteFileW(wbuf);
      MBTOWIDE_FREE(wbuf);
      return rv;
    }
    MBTOWIDE_FREE(wbuf);
  }
  return DeleteFileA(path);
}
开发者ID:safetydank,项目名称:wdl-android,代码行数:15,代码来源:win32_utf8.c

示例8: test_AdvInstallFile

static void test_AdvInstallFile(void)
{
    HRESULT hr;
    HMODULE hmod;
    char CURR_DIR[MAX_PATH];
    char destFolder[MAX_PATH];

    hmod = LoadLibrary("setupapi.dll");
    if (!hmod)
    {
        skip("setupapi.dll not present\n");
        return;
    }

    FreeLibrary(hmod);

    GetCurrentDirectoryA(MAX_PATH, CURR_DIR);

    lstrcpyA(destFolder, CURR_DIR);
    lstrcatA(destFolder, "\\");
    lstrcatA(destFolder, "dest");

    createTestFile("source.txt");

    /* try invalid source directory */
    hr = pAdvInstallFile(NULL, NULL, "source.txt", destFolder, "destination.txt", 0, 0);
    ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %d\n", hr);
    ok(!DeleteFileA("dest\\destination.txt"), "Expected dest\\destination.txt to not exist\n");

    /* try invalid source file */
    hr = pAdvInstallFile(NULL, CURR_DIR, NULL, destFolder, "destination.txt", 0, 0);
    ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %d\n", hr);
    ok(!DeleteFileA("dest\\destination.txt"), "Expected dest\\destination.txt to not exist\n");

    /* try invalid destination directory */
    hr = pAdvInstallFile(NULL, CURR_DIR, "source.txt", NULL, "destination.txt", 0, 0);
    ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %d\n", hr);
    ok(!DeleteFileA("dest\\destination.txt"), "Expected dest\\destination.txt to not exist\n");

    /* try copying to nonexistent destination directory */
    hr = pAdvInstallFile(NULL, CURR_DIR, "source.txt", destFolder, "destination.txt", 0, 0);
    ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
    ok(DeleteFileA("dest\\destination.txt"), "Expected dest\\destination.txt to exist\n");

    /* native windows screws up if the source file doesn't exist */

    /* test AIF_NOOVERWRITE behavior, asks the user to overwrite if AIF_QUIET is not specified */
    createTestFile("dest\\destination.txt");
    hr = pAdvInstallFile(NULL, CURR_DIR, "source.txt", destFolder,
                         "destination.txt", AIF_NOOVERWRITE | AIF_QUIET, 0);
    ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
    ok(DeleteFileA("dest\\destination.txt"), "Expected dest\\destination.txt to exist\n");
    ok(RemoveDirectoryA("dest"), "Expected dest to exist\n");

    DeleteFileA("source.txt");
}
开发者ID:bilboed,项目名称:wine,代码行数:56,代码来源:files.c

示例9: GetFullPathNameA

void NetworkPacketDumper::deleteAdapterFiles() {
	std::list<NetworkAdapter*>::iterator it;
	for(it = adapterList.begin(); it != adapterList.end(); it++)
	{
		string adapterName = (*it)->getAdapterName();
		char* szLogFileName = new char[1024];
		string logName = "logs\\";
		logName += adapterName;
		logName += ".pcap";
		GetFullPathNameA(logName.c_str(), 1024, szLogFileName, NULL);
		LOG(INFO, "NetworkdPacketDumper: deleting log files %s",logName.c_str());
		DeleteFileA(szLogFileName);
		delete [] szLogFileName;
	}
	
}
开发者ID:340211173,项目名称:capture-hpc,代码行数:16,代码来源:NetworkPacketDumper.cpp

示例10: _tmain

int _tmain(int argc, _TCHAR* argv[])
{
    if (argc > 1 && argv[1])
    {
        char path[1000] {};
        WideCharToMultiByte(CP_UTF8, 0, argv[1], -1, path, 1000, 0, 0);
        std::string out(path);
        out.append(".temp");
        if (MoveFileA(path, out.c_str()) == TRUE)
        {
            Parse(out, path);
            DeleteFileA(out.c_str());
        }
    }
    return 0;
}
开发者ID:jaylauffer,项目名称:loadngo,代码行数:16,代码来源:BuildNum.cpp

示例11: SvcCtrlHandler

void WINAPI SvcCtrlHandler(DWORD dwCtrl)
{
	switch (dwCtrl)
	{
	case SERVICE_CONTROL_STOP:
		ReportSvcStatus(SERVICE_STOP_PENDING, NO_ERROR, 0);
		DeleteFileA("\\\\.\\pipe\\TagServicePipe");
		SetEvent(ghSvcStopEvent);
		return;

	case SERVICE_CONTROL_INTERROGATE:
		break;

	default:
		break;
	}
}
开发者ID:Jereq,项目名称:TagSystem,代码行数:17,代码来源:Service.cpp

示例12: SetAvatar

static void SetAvatar(HANDLE hContact, JABBER_LIST_ITEM *item, char *data, int len, DWORD format) {
	FILE* out;
	char filename[MAX_PATH];
	char md5[33];
	MD5 context;
	int i;
	md5_init(&context);
	md5_update(&context, data, len);
	md5_finalize(&context);
	if (format == PA_FORMAT_UNKNOWN && len > 4) {
		format = JabberGetPictureType(data);
	}
	for (i=0;i<16;i++) {
		char lo, hi;
		unsigned int j=context.state[i>>2];
		j>>=8*(i%4);
		j&=0xFF;
		lo = j & 0x0F;
		hi = j >> 4;
		hi = hi + ((hi > 9) ? 'a' - 10 : '0');
		lo = lo + ((lo > 9) ? 'a' - 10 : '0');
		md5[i*2] = hi;
		md5[i*2+1] = lo;
	}
	md5[i*2] = 0;
	if (item != NULL) {
		char *hash = item->avatarHash;
		item->avatarFormat = format;
		item->avatarHash = mir_strdup(md5);
		mir_free(hash);
	} else {
		jabberThreadInfo->avatarFormat = format;
		strcpy(jabberThreadInfo->avatarHash, md5);
	}
	TlenGetAvatarFileName(item, filename, sizeof filename );
	DeleteFileA(filename);
	out = fopen( filename, "wb" );
	if ( out != NULL ) {
		fwrite( data, len, 1, out );
		fclose( out );
		DBWriteContactSettingString(hContact, "ContactPhoto", "File", filename );
		DBWriteContactSettingString(hContact, jabberProtoName, "AvatarHash",  md5);
		DBWriteContactSettingDword(hContact, jabberProtoName, "AvatarFormat",  format);
	}
	ProtoBroadcastAck( jabberProtoName, hContact, ACKTYPE_AVATAR, ACKRESULT_STATUS, NULL , 0);
}
开发者ID:BackupTheBerlios,项目名称:mtlen-svn,代码行数:46,代码来源:tlen_avatar.c

示例13: CleanUp

BOOL CleanUp(HANDLE hFile, const char * fileName)
{
    BOOL bRc = TRUE;
    if (CloseHandle(hFile) != TRUE)
    {
        bRc = FALSE;
        Trace("WriteFile: ERROR -> Unable to close file \"%s\","
            " error: %ld.\n", fileName, GetLastError());
    }
    if (!DeleteFileA(fileName))
    {
        bRc = FALSE;
        Trace("WriteFile: ERROR -> Unable to delete file \"%s\","
            " error: %ld.\n", fileName, GetLastError());
    }
    return bRc;
}
开发者ID:smartmaster,项目名称:sscli,代码行数:17,代码来源:writefile.c

示例14: Cleanup

BOOL Cleanup(void)
{
    char FileName[20];
    int i;
    BOOL bRet = TRUE; // assume success

    // loop through all accesses, modes, dispositions and flags
    for (i=0; i<4*8*4*5; ++i) {
        sprintf(FileName, "test%03d.txt", i);
	if (DeleteFileA(FileName) == FALSE) {
	    if (GetLastError() != ERROR_FILE_NOT_FOUND) {
		bRet = FALSE;
	    }
	}
    }
    return bRet;
}
开发者ID:smartmaster,项目名称:sscli,代码行数:17,代码来源:createfilew.c

示例15: getSystemType

    //--------------------------------
    bool Utils::deleteFile(const String &pathString)
    {
        SystemType type = getSystemType();

#ifdef COLLADABU_OS_WIN
        if (type != WINDOWS)
            return false;
        return DeleteFileA(pathString.c_str()) != FALSE;
#else
        if (type != POSIX)
            return false;
        char command[4097];
        sprintf(command, "rm -f \"%s\"", pathString.c_str());
        int status = system(command);
        return status == 0;
#endif
    }
开发者ID:Fredounet,项目名称:OpenCOLLADA,代码行数:18,代码来源:COLLADABUUtils.cpp


注:本文中的DeleteFileA函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。