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


C++ FileManager::createFile方法代码示例

本文整理汇总了C++中FileManager::createFile方法的典型用法代码示例。如果您正苦于以下问题:C++ FileManager::createFile方法的具体用法?C++ FileManager::createFile怎么用?C++ FileManager::createFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FileManager的用法示例。


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

示例1: DistributedFileSystemManager

/**
 * Constructor.
 * 
 * Created the master file which stores all the meta data about various distributed file systems.
 */
DistributedFileSystemManager :: DistributedFileSystemManager(const string root_path) {
    this->root_path = root_path;
    
    // Create meta data file.
    const string path = root_path + "/" +  METADATA_FILE;
    
    FileManager fileManager;
    if (!fileManager.findIfExists(path) && !fileManager.createFile (path, "")) {
        cout << "Failed to create DFS manager metadata file." << endl;
        exit(1);
    }
}
开发者ID:Rikson,项目名称:Woot,代码行数:17,代码来源:DistributedFileSystemManager.cpp

示例2: init

void init() {
	FileManager* fm = new FileManager();
	BufPageManager* bpm = new BufPageManager(fm);
	fm->createFile("testfile.txt"); //新建文件
	int fileID;
	fm->openFile("testfile.txt", fileID); //打开文件,fileID是返回的文件id

	int index;
	BufType b = bpm->allocPage(fileID, 0, index, true);
	b[0] = 256;
	b[1] = 100;
	b[2] = 0;
	b[3] = 0;
	for (int i = 0; i < b[1]; i++) {
		b[i+4] = 0;
	}
	bpm->markDirty(index);
	fm->writePage(fileID, 0, b, 0);
	bpm->close();
}
开发者ID:AnthonyWang14,项目名称:DB_prj,代码行数:20,代码来源:testfilesystem.cpp

示例3: main

int main() {
	FileManager* fm = new FileManager();
	BufPageManager* bpm = new BufPageManager(fm);
	fm->createFile("testfile.txt"); //新建文件
	int fileID;
	fm->openFile("testfile.txt", fileID); //打开文件,fileID是返回的文件id
	for (int pageID = 0; pageID < 1000; ++ pageID) {
		int index;
		//为pageID获取一个缓存页
		BufType b = bpm->allocPage(fileID, pageID, index, false);
		b[0] = pageID; //对缓存页进行写操作
		bpm->markDirty(index); //标记脏页
	}
	for (int pageID = 0; pageID < 1000; ++ pageID) {
		int index;
		//为pageID获取一个缓存页
		BufType b = bpm->getPage(fileID, pageID, index);
		cout << b[0] << endl; 		//读取缓存页中第一个整数
		bpm->access(index); //标记访问
	}
	return 0;
}
开发者ID:Naiselim,项目名称:database,代码行数:22,代码来源:testfilesystem.cpp


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