• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ copyFile函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: copyFile

void MeshSerializerTests::tearDown()
{

	// Copy back original file.
	if (!mMeshFullPath.empty()) {
		copyFile(mMeshFullPath + ".bak", mMeshFullPath);
	}
	if (!mSkeletonFullPath.empty()) {
		copyFile(mSkeletonFullPath + ".bak", mSkeletonFullPath);
	}
	if (!mMesh.isNull()) {
		mMesh->unload();
		mMesh.setNull();
	}
	if (!mOrigMesh.isNull()) {
		mOrigMesh->unload();
		mOrigMesh.setNull();
	}
	if (!mSkeleton.isNull()) {
		mSkeleton->unload();
		mSkeleton.setNull();
	}
	OGRE_DELETE MeshManager::getSingletonPtr();
	OGRE_DELETE SkeletonManager::getSingletonPtr();
	OGRE_DELETE DefaultHardwareBufferManager::getSingletonPtr();
	OGRE_DELETE ArchiveManager::getSingletonPtr();
	OGRE_DELETE MaterialManager::getSingletonPtr();
	OGRE_DELETE LodStrategyManager::getSingletonPtr();
	OGRE_DELETE ResourceGroupManager::getSingletonPtr();
	OGRE_DELETE_T(mFSLayer, FileSystemLayer, Ogre::MEMCATEGORY_GENERAL);
	OGRE_DELETE mLogManager;
}
开发者ID:j-rivero,项目名称:ogre-acornacorn,代码行数:32,代码来源:MeshSerializerTests.cpp


示例2: main

int main() {
	char *charv = "This is a test string.";
	//strlen is from string.h - it returns the length of a char or char*
	int charv_length = strlen(charv);
	//char* resultString;	// will result in segfault because size of variable is unknown
							//and it cannot be inserted into string or strcat'ed
	
	char resultString[255]; //perfectly valid 
	
	//%i %c %s tokens are int, char, and char* respectively
	//sprintf will create strings instead of printing to stdout
	sprintf(resultString, "Variable: \"%s\" is %i characters long!", charv, charv_length);
	
	printf("\n%s", resultString);
	
	//if comparisons result in either 0 or 1, without a test operand, 1 is true
	if (fileExists_ACCESS(FILENAME)) printf("\nFile %s Exists!\n", FILENAME);
	else printf("File %s Does not exist!\n", FILENAME);
	
	copyFile(FILENAME,"file2");
	
	if (!copyFile(FILENAME,"file2")) printf("file copied!\n"); //if the result of copyFile() is not 1
		
	return 0;
}
开发者ID:raidzero,项目名称:Learning-C,代码行数:25,代码来源:hello.c


示例3: CA_Init

long CA_Init(void)
{
	FILE * cafile;
	char   capath[256];

	sprintf(capath, "%s%s\\CaFile.data", ddbsdk.ddbsdk_path_main, DDBSDK_MAINPATH_NAME);
	//if((cafile = fopen(capath, "rb")) == NULL) {
	if((cafile = fopen("softcard.ca", "rb")) == NULL) {
		if (1 <= copyFile("\\NANDFlash\\softcard.ca", "\\Flash_Storage\\softcard.ca"))
		{
			printf("CA文件还原失败!\n");
			return -1;
		}
		if((cafile = fopen("softcard.ca", "rb")) == NULL) 
		{
			printf("CA文件无法打开!\n");
			return -1;
		}

	}

	printf("CA文件成功打开!\n");
	
	g_BufferForCAS = (BYTE *)malloc(FOR_CAS_DATA_BUFFER_SIZE);
	memset(g_BufferForCAS, 0, FOR_CAS_DATA_BUFFER_SIZE);
	fread(g_BufferForCAS, 1, FOR_CAS_DATA_BUFFER_SIZE, cafile);
	fclose(cafile);
	if(!DVTCASTB_Init())
	{
		printf("CA初始化失败!\n");
		printf("尝试还原CA文件\n");
		if (1 <= copyFile("\\NANDFlash\\softcard.ca", "\\Flash_Storage\\softcard.ca"))
		{
			printf("CA文件还原失败!\n");
			free(g_BufferForCAS);
			return -1;
		}
		if((cafile = fopen("softcard.ca", "rb")) == NULL) 
		{
			printf("CA文件无法打开!\n");
			free(g_BufferForCAS);
			return -1;
		}
		fread(g_BufferForCAS, 1, FOR_CAS_DATA_BUFFER_SIZE, cafile);
		fclose(cafile);
		if(!DVTCASTB_Init())
		{
			printf("CA初始化失败!\n");
			free(g_BufferForCAS);
			return -1;
		}
	}

	printf("CA初始化成功!\n");

	return 0;
}
开发者ID:nasacj,项目名称:ddb_sdk,代码行数:57,代码来源:CA_STB_decode.cpp


示例4: catch

void MeshSerializerTests::testMesh_Version_1_2()
{
	// Exporting legacy Mesh not supported!
	// testMesh(MESH_VERSION_LEGACY);

#ifdef I_HAVE_LOT_OF_FREE_TIME
	// My sandboxing test. Takes a long time to complete!
	// Runs on all meshes and exports all to every Lod version.
	char* groups [] = { "Popular", "General", "Tests" };
	for (int i = 0; i < 3; i++) {
		StringVectorPtr meshes = ResourceGroupManager::getSingleton().findResourceNames(groups[i], "*.mesh");
		StringVector::iterator it, itEnd;
		it = meshes->begin();
		itEnd = meshes->end();
		for (; it != itEnd; it++) {
			try {
				mMesh = MeshManager::getSingleton().load(*it, groups[i]);
			}
			catch(std::exception e)
			{
				// OutputDebugStringA(e.what());
			}
			getResourceFullPath(mMesh, mMeshFullPath);
			if (!copyFile(mMeshFullPath + ".bak", mMeshFullPath)) {
				// If there is no backup, create one.
				copyFile(mMeshFullPath, mMeshFullPath + ".bak");
			}
			mOrigMesh = mMesh->clone(mMesh->getName() + ".orig.mesh", mMesh->getGroup());
			testMesh_XML();
			testMesh(MESH_VERSION_1_10);
			testMesh(MESH_VERSION_1_8);
			testMesh(MESH_VERSION_1_7);
			testMesh(MESH_VERSION_1_4);
			testMesh(MESH_VERSION_1_0);
		}
		meshes = ResourceGroupManager::getSingleton().findResourceNames(groups[i], "*.skeleton");
		it = meshes->begin();
		itEnd = meshes->end();
		for (; it != itEnd; it++) {
			mSkeleton = SkeletonManager::getSingleton().load(*it, groups[i]);
			getResourceFullPath(mSkeleton, mSkeletonFullPath);
			if (!copyFile(mSkeletonFullPath + ".bak", mSkeletonFullPath)) {
				// If there is no backup, create one.
				copyFile(mSkeletonFullPath, mSkeletonFullPath + ".bak");
			}
			SkeletonSerializer skeletonSerializer;
			skeletonSerializer.exportSkeleton(mSkeleton.get(), mSkeletonFullPath, SKELETON_VERSION_1_8);
			mSkeleton->reload();
			skeletonSerializer.exportSkeleton(mSkeleton.get(), mSkeletonFullPath, SKELETON_VERSION_1_0);
			mSkeleton->reload();
		}
	}
#endif /* ifdef I_HAVE_LOT_OF_FREE_TIME */
}
开发者ID:j-rivero,项目名称:ogre-acornacorn,代码行数:54,代码来源:MeshSerializerTests.cpp


示例5: replacementTruncate

/*  Replacement for missing library function.
 */
static int replacementTruncate (const char *const name, const long size)
{
	char *tempName = NULL;
	FILE *fp = tempFile ("w", &tempName);
	fclose (fp);
	copyFile (name, tempName, size);
	copyFile (tempName, name, WHOLE_FILE);
	remove (tempName);
	eFree (tempName);

	return 0;
}
开发者ID:mapad,项目名称:ctags,代码行数:14,代码来源:entry.c


示例6: prepareMsiData

void prepareMsiData(int localeId) {
  String msiFilePath = getTmpPath() + kMsiFileName;
  // Copy msi file to temp
  copyFile(IDR_MSI, msiFilePath);
  
  // Don't need transform for English (United States)
  if (localeId != kEnglishLocalId) {
    String transformFile = createFileName(localeId);
    String transformFilePath = getTmpPath() + transformFile;
    // Copy mst file to temp if needed
    copyFile(localeId, transformFilePath);
  }
}
开发者ID:Inzaghi2012,项目名称:ie-toolbar,代码行数:13,代码来源:MsiUtils.cpp


示例7: newProfile

    void newProfile( const std::string& profile )
    {
        _mkdir( ( "profiles/"+profile ).c_str() );
        _mkdir( ( "profiles/"+profile + "/save" ).c_str() );
        _mkdir( ( "profiles/"+profile + "/config" ).c_str() );

        // should copy the default keybinds to the
        // profiles/"profile"/config/
#ifdef LEGACY_FILES
        copyFile( "Data/Misc/keybinds.txt", "profiles/"+profile+"/config/keybinds.txt" );
#else
        copyFile( "data/misc/default_keybinds.txt", "profiles/"+profile+"/config/keybinds.txt" );
#endif

    }
开发者ID:DeejStar,项目名称:Jack-Claw,代码行数:15,代码来源:GameProfiles.cpp


示例8: processImbedFile

/*------------------------------------------------------------------
 * process the imbed file option
 *------------------------------------------------------------------*/
void processImbedFile(
   char *imbedFileName
   )
   {
   FILE *file;

   /*---------------------------------------------------------------
    * while we have imbedFileNames
    *---------------------------------------------------------------*/
   imbedFileName = strtok(imbedFileName,";,");
   while (imbedFileName)
      {
      /*------------------------------------------------------------
       * open the imbed file
       *------------------------------------------------------------*/
      file = fopen(imbedFileName,"r");

      /*------------------------------------------------------------
       * print error if not found, or copy it in if found
       *------------------------------------------------------------*/
      if (!file)
         cPostError(0,"unable to open file '%s' for reading",imbedFileName);
      else
         {
         copyFile(file,info.oFile);
         fclose(file);
         }

      /*------------------------------------------------------------
       * get next imbed file name
       *------------------------------------------------------------*/
      imbedFileName = strtok(NULL,";,");
      }
   }
开发者ID:pmuellr,项目名称:cpost,代码行数:37,代码来源:cpost.c


示例9: if

axStatus	axFileSystem::copyDir	( const char* src, const char* dst, bool skipFileStartsWithDot ) {
	axStatus st;

	axDir::Entry e;
	axTempStringA src_file, dst_file;

	axDir dir;
	st = dir.open( src ); if( !st ) return st;

	_makeDir( dst );

	while( dir.next( e ) ) {
		if( skipFileStartsWithDot ) {
			if( e.name.startsWith(".") ) continue;
		}
		if( e.name.equals(".")  ) continue;
		if( e.name.equals("..") ) continue;

		st = src_file.format("{?}/{?}", src, e.name );	if( !st ) return st;
		st = dst_file.format("{?}/{?}", dst, e.name );	if( !st ) return st;

		if( e.isDir() ) {
			st = copyDir ( src_file, dst_file, skipFileStartsWithDot ); if( !st ) return st;
		}else {
			st = copyFile( src_file, dst_file ); if( !st ) return st;
		}

	}

	return 0;
}
开发者ID:Jasonchan35,项目名称:libax,代码行数:31,代码来源:axFileSystem.cpp


示例10: main

int main(int argc, char *argv[])
{
    int i, src, dest;
    char buffer[BUF_SIZE];

    if(argc != 3)  /*	We need exactly 2 arguments.	*/
	return (1);

    if((src = open(argv[1], O_RDONLY)) == -1) {
	close(src);/*	Opening the source file.	*/
	return (1);
    }

    if((dest = open(argv[2], O_WRONLY | O_CREAT | O_TRUNC, 0644)) == -1) {
	close(dest); /* Opening the destination file.	*/
	return (1);
    }

    if((i = copyFile(src, dest, buffer)) == 1)
	return i;	/*	Making the copy.	*/
	
    if(close(src) == -1 || close(dest) == -1)
	return (1);	/*	Closing the files.	*/
    
    return (0);
}
开发者ID:havk64,项目名称:holbertonschool-low_level_programming,代码行数:26,代码来源:main.c


示例11: main

int main(int argc, char *argv[]) {
    char *source_file;
    char *new_file;

    // Program calistirilirken verilen argumanların dogru sekilde
    // olup olmadigi kontrolu yapilmaktadir. Eger argumanlar dogru
    // sekilde verildiyse, kaynak dosya ve yeni dosya bilgisi ilgili
    // degiskenlere atanir.
    if (argc == 3) {
        source_file = argv[1];
        new_file = argv[2];
    }

    // Argumanlar hatali bir sekilde verilmisse ekrana dogru sekli yazdirilir.
    else {
        printf("Programi yanlis sekilde calistirdiniz.\n");
        printf("Dogrusu su sekilde olmalidir: ./kopyala /dirx/../kaynak_dosya /diry/../yeni_dosya\n");
        exit(1);
    }


    // Kopyalama isleminin 2 saniyeden uzun surmesi durumunda ekranda bilgi
    // mesaji gosterilmesi icin bir signal olusturulur ve alarm 2 saniyeye
    // ayarlanir.
    signal(SIGALRM, display_message);
    alarm(2);


    // Kopyalama islemi baslatilir.
    copyFile(source_file, new_file);


    alarm(0);
    return 0;
}
开发者ID:bbuyukguzel,项目名称:Homework,代码行数:35,代码来源:kopyala.c


示例12: copyFile

bool CShop::LoadConfig()
{

  char* fileName = "ShopItem.txt";
  if (!IsFileExist(fileName, TXT_PATH))
    copyFile(fileName, TXT_PATH);
  string fullFilePath = getFilePath(fileName, TXT_PATH);
  int fileLen = strlen(fullFilePath.c_str());
  if (!fileLen)
    return false;
  char buffer[256];  
  ifstream in(fullFilePath);  
  if (! in.is_open())  
  { 
    cout << "Error opening file ShopItem"; 
    return false; 
  }
  int Line = 0;
  while (EOF != in.peek() )  
  { 
    in.getline (buffer,256);
    GParse GP(buffer);
    ShopData Item;
    Item.Id = GP.getInt();
    Item.money = GP.getInt();
    _ShopDatas.push_back(Item);
  }
  return true;
}
开发者ID:wctstc,项目名称:EarthExplore,代码行数:29,代码来源:DataManager.cpp


示例13: while

bool QGenieExport2DiskFileThread::copyMacOSAppBundle(const QString &destDir)
{
    const char* file2copy_array[] =
    {
        ":/GenieWirelessConfig.app/Contents/MacOS/GenieWirelessConfig",
        ":/GenieWirelessConfig.app/Contents/Resources/English.lproj/InfoPlist.strings",
        ":/GenieWirelessConfig.app/Contents/Resources/English.lproj/MainMenu.nib",
        ":/GenieWirelessConfig.app/Contents/Resources/GenieWirelessConfig.icns",
        ":/GenieWirelessConfig.app/Contents/Info.plist",
        ":/GenieWirelessConfig.app/Contents/PkgInfo",
        NULL
    };

    int index = 0;
    while(file2copy_array[index] != NULL)
    {
        if(!copyFile(QString(file2copy_array[index]),destDir))
        {
            return false;
        }

        ++index;
    }

    return true;
}
开发者ID:daddyreb,项目名称:Bigit_Genie,代码行数:26,代码来源:QGenieExport2DiskFileThread.cpp


示例14: throw

/**
 * Moves file from source <code>srcPath</code> to destination <code>destPath</code>.
 *
 * @param srcPath source full file path.
 * @param destPath destination full file path.
 * @param overwrite whether to overwrite existing file.
 * @throws IOException exception is thrown if overwrite flag is set to false and destination file already exists.
 *         Or the file move operation failed.
 */
void digidoc::util::File::moveFile(const std::string& srcPath, const std::string& destPath, bool overwrite) throw(IOException)
{
    if(!fileExists(srcPath))
    {
        THROW_IOEXCEPTION("Source file '%s' does not exist.", srcPath.c_str());
    }

    if(!overwrite && fileExists(destPath))
    {
        THROW_IOEXCEPTION("Destination file exists '%s' can not move to there. Overwrite flag is set to false.", destPath.c_str());
    }

    f_string _srcPath = encodeName(srcPath);
    f_string _destPath = encodeName(destPath);
    int result = f_rename(_srcPath.c_str(), _destPath.c_str());
    if ( result != 0 )
    {
		// -=K=-: copy and remove source should work as move between different partitions
		copyFile( srcPath, destPath, overwrite );
        result = f_remove( _srcPath.c_str() );
    }
	if ( result != 0 )
	{
		// -=K=-: suceeded to copy, failed to remove. Should we throw or warn?
		WARN( "Failed to remove source file '%s' when moving it to '%s'.", _srcPath.c_str(), _destPath.c_str() );
	}

}
开发者ID:Krabi,项目名称:idkaart_public,代码行数:37,代码来源:File.cpp


示例15: removeSegmentInfoInformation

void removeSegmentInfoInformation(RVMINFO* currNode, const char* segment) {
    char* segInfoFileName = combinePaths(currNode->directory, SEGINFO_FILE);
    FILE* fd = fopen(segInfoFileName, "r");
    if (fd) {
        char line[1024];
        char *tempFileName = combinePaths(currNode->directory, "lrvmSEGINFO""tmp");
        FILE* tempFIleFd = fopen(tempFileName, "w");
        while (readLineFromFile(fd,line,sizeof(line))) {
            if (startsWith(SEGNAMESTR, line) && !strcmp(line + strlen(SEGNAMESTR), segment)) {
                readLineFromFile(fd,line,sizeof(line));
            } else {
                fprintf(tempFIleFd, "%s\n", line);
            }
        }
        fclose(tempFIleFd);
        fclose(fd);
        copyFile(tempFileName, segInfoFileName);
        deleteFile(tempFileName);
        free(tempFileName);
        char* targetSegmentFile = combinePaths(currNode->directory, segment);

        //Delete the backing store
        deleteFile(targetSegmentFile);
        free(targetSegmentFile);
    }
    free(segInfoFileName);
}
开发者ID:Machiry,项目名称:AOS,代码行数:27,代码来源:segutilities.c


示例16: copyDynlibs

bool copyDynlibs( Options& options, const String& mp, const std::vector<String>& dynlibs )
{
   // On windows, the thing is simple. 
   // We must add the module named as <module>.dll besides the host module if it's binary, 
   // or in the Falcon system dir if it's a source module.

   Path modpath( mp );
   Path targetPath;
   String ext = modpath.getExtension();
   ext.lower();

   // binary module ?
   if( ext == DllLoader::dllExt() )
      targetPath.setFullLocation( options.m_sTargetDir + "/" + options.m_sSystemRoot );
   else
      targetPath = modpath;

   bool retval = true;
   for ( uint32 i = 0; i < dynlibs.size(); ++i )
   {
      modpath.setFilename( dynlibs[i] + "." + DllLoader::dllExt() );
      targetPath.setFilename( dynlibs[i] + "." +  DllLoader::dllExt() );

      if( ! copyFile( modpath.get(), targetPath.get() ) )
      {
         warning( "Cannot copy dynlib resource " + modpath.get() );
         retval = false;
      }
   }
   
   return retval;
}
开发者ID:Klaim,项目名称:falcon,代码行数:32,代码来源:falpack_sys_win.cpp


示例17: perform

	string perform(const shared_ptr< const Config >& /* config */, const download::Uri& uri,
			const string& targetPath, const std::function< void (const vector< string >&) >& callback)
	{
		auto sourcePath = uri.getOpaque();
		auto protocol = uri.getProtocol();

		// preparing source
		string openError;
		File sourceFile(sourcePath, "r", openError);
		if (!openError.empty())
		{
			return format2("unable to open the file '%s' for reading: %s", sourcePath, openError);
		}

		if (protocol == "copy")
		{
			return copyFile(sourcePath, sourceFile, targetPath, callback); // full copying
		}
		else if (protocol == "file")
		{
			// symlinking
			unlink(targetPath.c_str()); // yep, no error handling;
			if (symlink(sourcePath.c_str(), targetPath.c_str()) == -1)
			{
				return format2e("unable to create symbolic link '%s' -> '%s'", targetPath, sourcePath);
			}
			return string();
		}
		else
		{
			fatal2i("a wrong scheme '%s' for the 'file' download method", protocol);
			return string(); // unreachable
		}
	}
开发者ID:cvalka4,项目名称:cupt,代码行数:34,代码来源:file.cpp


示例18: sqlite3_close

void CMasterDAOFactorySQLite::save()
{
    // Closing temp database
    m_PfVersionDAOSQLite->setSQLite(NULL);
    m_PfGamesDAOSQLite->setSQLite(NULL);
    m_PfUsersDAOSQLite->setSQLite(NULL);

    sqlite3_close(m_database);
    m_database = NULL;

    // Copying data to original database
    copyFile(m_filepath_tmp, m_filepath);
    LOG_DEBUG("[CMasterDAOFactorySQLite::save] SQLite Database saved: '%s'", m_filepath.c_str());

    // Reopening temp database
    if( sqlite3_open(m_filepath_tmp.c_str(), &m_database )!=SQLITE_OK ){
        sqlite3_close(m_database);
        m_database = NULL;
        throw PFEXCEPTION("Can't open database file: '%s' --> '%s'", m_filepath_tmp.c_str(), sqlite3_errmsg(m_database));
    }

    m_PfVersionDAOSQLite->setSQLite(m_database);
    m_PfGamesDAOSQLite->setSQLite(m_database);
    m_PfUsersDAOSQLite->setSQLite(m_database);
}
开发者ID:dividio,项目名称:projectfootball,代码行数:25,代码来源:CMasterDAOFactorySQLite.cpp


示例19: qDebug

void FileManager::run()
{
    qDebug() << "run the thread to copy file...";

    if( isPath( srcfileName) )
    {
        //qDebug() << srcfileName << destinationPath;
        copyFolder(srcfileName, destinationPath);
    }
    else
    {
        copyFile(srcfileName, destinationPath);
    }

    qDebug() << "copy done!";

//    fileSize = src.size();
//    int oldPercent = 0;
//    for(qint64 index = 0; index < fileSize; ++index)
//    {
//        dst.write(src.read(index));
//        src.seek(index);
//        dst.seek(index);

//        int percent = ((index + 1) * 100) / fileSize;
//        if (oldPercent != percent)
//        {
//            emit verificationProgressSignal(percent);
//            oldPercent = percent;
//        }
//    }
    //emit verificationDone();
}
开发者ID:newdebug,项目名称:NewDebug,代码行数:33,代码来源:filemanager.cpp


示例20: main

int main(int argc, char** argv) {

    checkArgs(argc, argv);
    copyFile(argv[1], argv[2]);

    return 0;
}
开发者ID:Bipsy,项目名称:Linux,代码行数:7,代码来源:Copy.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ copyFrom函数代码示例发布时间:2022-05-30
下一篇:
C++ copyData函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap