예제 #1
0
/*static*/ SimpleString SimpleString::PrintF( const char* FormatString, ... )
{
	va_list Args;
	va_start( Args, FormatString );

	int Length = VSPRINTF_COUNT( FormatString, Args ) + 1;
	char* pBuffer = Allocate( Length );
	VSPRINTF( pBuffer, Length, FormatString, Args );

	SimpleString RetVal( pBuffer );
	SafeDeleteArray( pBuffer );

	return RetVal;
}
예제 #2
0
int DynamicMemoryStream::PrintF(const char* Str, ...) const {
  va_list Args;
  int Length = 0;
  char* Buffer = nullptr;
  int RetVal = 0;

  va_start(Args, Str);
  Length = VSPRINTF_COUNT(Str, Args) + 1;
  Buffer =
      new char[Length];  // TODO: Pool this instead of dynamically allocating
  VSPRINTF(Buffer, Length, Str, Args);

  RetVal = Write(Length - 1, Buffer);

  SafeDelete(Buffer);
  return RetVal;
}
예제 #3
0
int FileStream::PrintF( const char* Str, ... ) const
{
	ASSERT( m_FileMode == EFM_Write || m_FileMode == EFM_Append );

	va_list	Args;
	int		Length	= 0;
	char*	Buffer	= NULL;
	int		RetVal	= 0;

	va_start( Args, Str );
	Length = VSPRINTF_COUNT( Str, Args ) + 1;
	Buffer = new char[ Length ];	// TODO: Pool this instead of dynamically allocating
	VSPRINTF( Buffer, Length, Str, Args );

	RetVal = Write( Length - 1, Buffer );

	SafeDelete( Buffer );
	return RetVal;
}