- 博客(0)
- 资源 (23)
- 收藏
- 关注
bison 2.4.1 fro windows
binso2.4.1 for windows setup url:http://gnuwin32.sourceforge.net/packages/bison.htm
2012-07-17
公司用的TRACE存储限制
unsigned int size;
std::list< std::string > files;
void initialize()
{
if( _access( "filelist.txt", 06 ) == 0 )
{
// 如果文件存在则从文件中读取有效的文件名
std::ifstream file( "filelist.txt" );
std::string str;
struct _stat buf;
while( std::getline( file, str ) )
{
if( !str.empty() )
{
files.push_back( str );
if( 0 == _stat( str.c_str(), &buf; ) )
{
size += buf.st_size;
}
}
}
}
else
{
// 如果文件不存在则以默认的时间作为先后顺序
struct _finddata_t fileinfo;
intptr_t hand = _findfirst( "E:\\source\\repos\\trace\\Debug\\*.tlog", &fileinfo; );
if( hand == -1 )
{
return;
}
files.push_back( fileinfo.name );
while( _findnext( hand, &fileinfo; ) == 0 )
{
files.push_back( fileinfo.name );
size += fileinfo.size;
}
_findclose( hand );
}
files.sort();
}
void DeleteOldTrace()
{
struct _stat buf;
if( 0 == _stat( "cur.tmf", &buf; ) )
{
size += buf.st_size;
}
// 删除最早的文件
std::string str;
std::string path = "E:\\source\\repos\\trace\\Debug\\";
std::list< std::string >::iterator it = files.begin();
while( size >= 1*1024 && it != files.end() )
{
str = path + it->c_str();
if( 0 == _stat( str.c_str(), &buf; ) )
{
size -= buf.st_size;
remove( str.c_str() );
it = files.erase( it );
}
else
{
++it;
}
}
// 重新写入到文件中
str = path + "filelist.txt";
std::ofstream file( str.c_str() );
if( file.is_open() )
{
for( it = files.begin(); it != files.end(); ++it )
{
file << (*it) << "\n";
}
file.close();
}
}
2012-03-11
公司用的trace记录
unsigned int size;
std::list< std::string > files;
void initialize()
{
if( _access( "filelist.txt", 06 ) == 0 )
{
// 如果文件存在则从文件中读取有效的文件名
std::ifstream file( "filelist.txt" );
std::string str;
struct _stat buf;
while( std::getline( file, str ) )
{
if( !str.empty() )
{
files.push_back( str );
if( 0 == _stat( str.c_str(), &buf; ) )
{
size += buf.st_size;
}
}
}
}
else
{
// 如果文件不存在则以默认的时间作为先后顺序
struct _finddata_t fileinfo;
intptr_t hand = _findfirst( "E:\\source\\repos\\trace\\Debug\\*.tlog", &fileinfo; );
if( hand == -1 )
{
return;
}
files.push_back( fileinfo.name );
while( _findnext( hand, &fileinfo; ) == 0 )
{
files.push_back( fileinfo.name );
size += fileinfo.size;
}
_findclose( hand );
}
files.sort();
}
void DeleteOldTrace()
{
struct _stat buf;
if( 0 == _stat( "cur.tmf", &buf; ) )
{
size += buf.st_size;
}
// 删除最早的文件
std::string str;
std::string path = "E:\\source\\repos\\trace\\Debug\\";
std::list< std::string >::iterator it = files.begin();
while( size >= 1*1024 && it != files.end() )
{
str = path + it->c_str();
if( 0 == _stat( str.c_str(), &buf; ) )
{
size -= buf.st_size;
remove( str.c_str() );
it = files.erase( it );
}
else
{
++it;
}
}
// 重新写入到文件中
str = path + "filelist.txt";
std::ofstream file( str.c_str() );
if( file.is_open() )
{
for( it = files.begin(); it != files.end(); ++it )
{
file << (*it) << "\n";
}
file.close();
}
}
2012-03-11
tiny core linux4.2.1
Tiny Core Linux是一份很小(10 MB)的最低限度Linux桌面。最新版本基于Linux 3.x内核、Busybox、Tiny X、FLTK图形用户界面、JWM窗口管理器,全部运行在内存中。它并非一份完整的桌面,也不完整支持所有的硬件;它只代表能引导进入一份最小X窗口桌面 所需的核心内容,典型情况下可包含对有线网络的访问。这份最小桌面可以通过从在线软件仓库安装额外应用软件来进行扩展
2012-02-29
C++0x实现类似于mpl的一个类型容器
用C++可变模板参数实现的一个类型容器,该代码只在GCC4.4上编译过,其他编译器可以不支持,使用者需要GCC4.4以上编译器,可以到GCC官网上下载
2010-04-26
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人