本文整理汇总了C++中FileManager::Find方法的典型用法代码示例。如果您正苦于以下问题:C++ FileManager::Find方法的具体用法?C++ FileManager::Find怎么用?C++ FileManager::Find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileManager
的用法示例。
在下文中一共展示了FileManager::Find方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Redirect
void Redirect(const tstring& fileName, const tchar_t* str, bool stampNewLine = true )
{
FILE* f = g_FileManager.Find(fileName);
if (f)
{
if ( stampNewLine )
{
_timeb currentTime;
_ftime( ¤tTime );
uint32_t time = (uint32_t) currentTime.time;
uint32_t milli = currentTime.millitm;
uint32_t sec = time % 60; time /= 60;
uint32_t min = time % 60; time -= currentTime.timezone; time /= 60;
time += currentTime.dstflag ? 1 : 0;
uint32_t hour = time % 24;
fprintf( f, "[%02d:%02d:%02d.%03d TID:%d] %s", hour, min, sec, milli, GetCurrentThreadId(), str );
}
else
{
fprintf( f, "%s", str );
}
fflush( f );
}
}
示例2: Redirect
void Redirect(const std::string& fileName, const char* str, bool stampNewLine = true )
{
File* f = g_FileManager.Find(fileName);
if (f)
{
size_t length = 0;
size_t count = ( StringLength( str ) + 128 );
char* temp = (char*)alloca( sizeof(char) * count );
if ( stampNewLine )
{
#if defined(HELIUM_OS_WIN)
_timeb currentTime;
_ftime( ¤tTime );
#else
struct timeb currentTime;
ftime( ¤tTime );
#endif
uint32_t time = (uint32_t) currentTime.time;
uint32_t milli = currentTime.millitm;
uint32_t sec = time % 60; time /= 60;
uint32_t min = time % 60; time -= currentTime.timezone; time /= 60;
time += currentTime.dstflag ? 1 : 0;
uint32_t hour = time % 24;
length = StringPrint( temp, count, TXT("[%02d:%02d:%02d.%03d TID:%d] %s"), hour, min, sec, milli, Thread::GetCurrentId(), str );
}
else
{
length = StringPrint( temp, count, TXT("%s"), str );
}
f->Write( temp, length );
f->Flush();
}
}