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


C++ copyFile函数代码示例

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


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


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