⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 filecachetest.cpp

📁 au1200 linux2.6.11 硬件解码mae驱动和maiplayer播放器源码
💻 CPP
字号:
/* <LIC_AMD_STD> * Copyright (C) 2003-2005 Advanced Micro Devices, Inc.  All Rights Reserved. *  * Unless otherwise designated in writing, this software and any related  * documentation are the confidential proprietary information of AMD.  * THESE MATERIALS ARE PROVIDED "AS IS" WITHOUT ANY * UNLESS OTHERWISE NOTED IN WRITING, EXPRESS OR IMPLIED WARRANTY OF ANY  * KIND, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY,  * NONINFRINGEMENT, TITLE, FITNESS FOR ANY PARTICULAR PURPOSE AND IN NO  * EVENT SHALL AMD OR ITS LICENSORS BE LIABLE FOR ANY DAMAGES WHATSOEVER.  *  * AMD does not assume any responsibility for any errors which may appear  * in the Materials nor any responsibility to support or update the * Materials.  AMD retains the right to modify the Materials at any time,  * without notice, and is not obligated to provide such modified  * Materials to you. AMD is not obligated to furnish, support, or make * any further information available to you. * </LIC_AMD_STD>  *//* <CTL_AMD_STD> * </CTL_AMD_STD>  *//* <DOC_AMD_STD> * </DOC_AMD_STD>  */// filecachetest.cpp : Defines the entry point for the console application.//#include <iostream>#include <stdio.h>#define CFUNC "C"#include "filecache.h"const char* fileNameTemplate = "test%dfile%d.txt";void test0(){    const int FILECOUNT = 12;    const int LINECOUNT = 10;	FILE *files[FILECOUNT];	for (int i=0; i < FILECOUNT; i++) {		char name[256];		sprintf(name, fileNameTemplate, 0, i);		std::cout << "Trying for " << name << std::endl;		files[i] = FileCacheGet(name);		fprintf(files[i], "Header for file %d\n", i);		FileCacheDone(files[i]);	}	for (int line = 0; line < LINECOUNT; line++) {		for (int i=0; i < FILECOUNT; i++) {			char name[256];	   		sprintf(name, fileNameTemplate, 0, i);			std::cout << "Trying for " << name << std::endl;			FILE *p = FileCacheGet(name);			fprintf(p, "A line (%d) of data for file %d\n", line, i);			if (p != files[i]) 				std::cout << "Failed to match file" << std::endl;			FileCacheDone(p);		}	}}void test1(){	// Thrash the cache    const int FILECOUNT = 13;    const int LINECOUNT = 10;	FILE *files[FILECOUNT];	for (int i=0; i < FILECOUNT; i++) {		char name[256];		sprintf(name, fileNameTemplate, 1, i);		std::cout << "Trying for " << name << std::endl;		files[i] = FileCacheGet(name);		fprintf(files[i], "Header for file %d\n", i);		FileCacheDone(files[i]);	}	for (int line = 0; line < LINECOUNT; line++) {		for (int i=0; i < FILECOUNT; i++) {			char name[256];	   		sprintf(name, fileNameTemplate, 1, i);			std::cout << "Trying for " << name << std::endl;			FILE *p = FileCacheGet(name);			fprintf(p, "A line (%d) of data for file %d\n", line, i);			FileCacheDone(p);		}	}}int main(int argc, char* argv[]){	test0();	test1();	return 0;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -