Beispiel #1
0
void Console( char *message, ... )
{
	char              msg_text[256];
	va_list           marker;
	
	va_start( marker, message );
	vsprintf_s( msg_text, message, marker );
	va_end( marker );
	//Now the message is stored in msg_text, you should probably display
	//it or something...
}
Beispiel #2
0
inline void __cdecl DebugPrintA(char *format, ...)
{
	static char buff[4096];
	static HANDLE outh = GetStdHandle(STD_OUTPUT_HANDLE);
	static DWORD written;
	va_list va;
	va_start(va, format);
	vsprintf_s(buff, format, va);
	WriteFile(outh, buff, strlen(buff), &written, NULL);
	va_end(va);
}
Beispiel #3
0
Ascii
Ascii::vformat(const Chr8* sFormat, va_list args)
{
    Size iLength = _vscprintf(sFormat, args);
    Chr8* pBuf = (Chr8*) NewBytes(iLength+1);
    vsprintf_s(pBuf, iLength + 1, sFormat, args);

    Ascii s;
    s.m_blob = Blob::own(pBuf,iLength+1);
    return s;
}
Beispiel #4
0
void	IWriter::w_printf(const char* format, ...)
{
	va_list mark;
	char buf[1024];

	va_start( mark , format );
		vsprintf_s( buf , format , mark );
	va_end( mark );

	w		( buf, xr_strlen(buf) );
}
Beispiel #5
0
void CCLog(const char * pszFormat, ...)
{
    char szBuf[MAX_LEN];

    va_list ap;
    va_start(ap, pszFormat);
    vsprintf_s(szBuf, MAX_LEN, pszFormat, ap);
    va_end(ap);
    OutputDebugStringA(szBuf);
    OutputDebugStringA("\n");
}
Beispiel #6
0
int cprintf(const char *__format, ...)
{
	char buffer[MAX_BUFFER];
	int r;
	va_list ap;
	va_start(ap, __format);
	r = vsprintf_s(buffer, __format, ap);
	va_end(ap);
	cputs(buffer);
	return r;
}
Beispiel #7
0
void Game::setTitle(const char*	format, ...)
{
	char buffer[4096];

	va_list lst;
	va_start(lst, format);
	vsprintf_s(buffer, 4096, format, lst);
	va_end(lst);

	set_window_title(buffer);
}
Beispiel #8
0
int Printf (const char *msg, ...)
{
	static char s[512];
	int ret=0;
	va_list ap;
	va_start(ap,msg);
	ret=vsprintf_s(s, sizeof(s), msg, ap);
	va_end(ap);
	AvpCallback(AVP_CALLBACK_PUT_STRING,(DWORD)s);
	return ret;
}
Beispiel #9
0
void you(char *fmt, ...)
{
  va_list vl;
  static char buffer[1000];

  va_start(vl, fmt);
  vsprintf_s(buffer, sizeof(buffer), fmt, vl);
  va_end(vl);
  
  message("You %s", buffer);
}
Beispiel #10
0
std::string DSKUtilities::format(std::string format, ...) {
	va_list arguments;
	va_start(arguments, format);
	int bufferSize = 200;
	char* buffer = new char[bufferSize];
	vsprintf_s(buffer, bufferSize, format.c_str(), arguments);
	va_end(arguments);
	std::string formatted = std::string(buffer);
	delete[] buffer;
	return formatted;
}
Beispiel #11
0
void SysMessage(const char *fmt, ...)
{
	va_list list;
	char tmp[512];

	va_start(list,fmt);
	vsprintf_s(tmp,fmt,list);
	va_end(list);

	MessageBox((hWMain==NULL) ? GetActiveWindow() : hWMain, tmp, "ZeroSPU2 Msg", MB_SETFOREGROUND | MB_OK);
}
//-----------------------------------------------------------------------------
//	Sys_Error
//
//-----------------------------------------------------------------------------
void Sys_Error( const char* format, ... )
{
	va_list		argptr;
	char		msg[MAX_SYSPRINTMSG];
		
	va_start( argptr,format );
	vsprintf_s( msg, sizeof( msg ), format, argptr );
	va_end( argptr );

	exit( 1 );
}
Beispiel #13
0
void LogToFile(const char *fn, const char *s, ...)
{
    char str[4000];

    va_list args;
    va_start(args, s);
    vsprintf_s(str, LENGTH(str), s, args);
    va_end(args);

    LogMessage(fn, nullptr, str);
}
Beispiel #14
0
bool AssertFailed(const char *file, int line, const char *s, ...)
{
    char str[4000];

    va_list args;
    va_start(args, s);
    vsprintf_s(str, LENGTH(str), s, args);
    va_end(args);

    return Warning("Assert failed at %s (%i)\n%s", file, line, str);
}
Beispiel #15
0
void DebugOut(const char* format, ...)
{
    char szbuf[Max_Buf_Size] = {0};
    va_list args;
    va_start(args, format);
    vsprintf_s(szbuf, format, args);
    va_end(args);

    OutputDebugString(szbuf);
    fprintf(stdout, "%s", szbuf) ;
}
Beispiel #16
0
char *string(char *fmt, ...)
{
  static char buffer[1000];
  va_list vl;

  va_start(vl, fmt);
  vsprintf_s(buffer, sizeof(buffer), fmt, vl);
  va_end(vl);

  return buffer;
}
Beispiel #17
0
// Helpers
int mysql_queryf(MYSQL* my,const char* fmt,...){
	char qstring[4096];
	va_list args;
	va_start(args,fmt);
	int len = vsprintf_s(qstring,sizeof(qstring),fmt,args);
	va_end(args);

	//printf("QUERY: %s\n",qstring);

	return mysql_real_query(my,qstring,len);
}
/* Testing primitives */
void die(const char* msg, ...)
{
    char buffer[512];
    va_list args;

    va_start(args, msg);
    vsprintf_s(buffer, 512, msg, args);
    va_end(args);
    puts(buffer);
    exit(1);
}
/**
*     Debug handler
*   http://bytes.com/forum/thread212702.html
*/            
void debug(char *fmt, ...)
{   
	if(WINDOWS_DEBUG) {
        char buffer[255];
        va_list argp;                    
        va_start(argp, fmt);
        vsprintf_s(buffer, fmt, argp);
        va_end(argp);
        OutputDebugString(buffer);
    } 
}
Beispiel #20
0
int DpPrintf(char* str,...)
{
	va_list args;
	va_start( args, str );
	char buf[4*1024];
	vsprintf_s(buf,4*1024,str,args);
	DWORD dwWritten;
	WriteFile( hWrite, buf, strlen(buf)+1, &dwWritten, NULL);  
	FlushFileBuffers(hWrite);
	return 0;
}
char *
OSSprintfFromSystem(const char *format, ...)
{
   va_list argptr;
   va_start(argptr, format);
   auto size = _vscprintf(format, argptr) + 1;
   auto buffer = reinterpret_cast<char *>(OSAllocFromSystem(size, 4));
   vsprintf_s(buffer, size, format, argptr);
   va_end(argptr);
   return buffer;
}
Beispiel #22
0
void DebugUtil_Win32_Impl::Error(const char* format, ...)
{
	va_list marker;
	va_start(marker, format);

	char szOut[MAX_BUFFER_SIZE];
	vsprintf_s(szOut, MAX_BUFFER_SIZE, format, marker);
	va_end(marker);

	OutputLog("ERROR: ", szOut);
}
Beispiel #23
0
	void LogError(const char* szFormat, ...)
	{
		static std::ofstream logFile("Game.log");

		va_list	args;
		char szBuffer[1000];
		va_start(args, szFormat);
		vsprintf_s(szBuffer, sizeof szBuffer, szFormat, args);
		va_end(args);
		logFile << "ERROR: " << szBuffer << std::endl;
	}
Beispiel #24
0
void ShowErrorMsg(HWND hWnd, const char* szTitle, const char* szFormat, ...)
{
	static char szError[1024];

	va_list ap;
	va_start(ap, szFormat);
	vsprintf_s(szError, szFormat, ap);
	va_end(ap);

	MessageBox(hWnd, szError, szTitle, MB_ICONERROR);
}
Beispiel #25
0
void Logger::Log(const LogLevel Level, const char* Format, ...)
{
    if (!m_bEnableFileLog && !m_bEnableDebugView && !m_bEnableConsole) {
        return;
    }

    if (m_LogLevel > Level) {
        return;
    }

    if (NULL == m_hLogFile && !Initialise()) {
        return;
    }

	char szBuffer[1024];

	va_list args;
    va_start(args, Format);
	vsprintf_s(szBuffer, Format, args);
	va_end(args);

#ifdef ENABLE_DEBUGVIEWER
    if (m_bEnableDebugView) {
        OutputDebugStringA(szBuffer);
    }
#endif

#ifdef ENABLE_CONSOLE
    if (m_bEnableConsole) {
        printf(szBuffer);
    }
#endif


    if (!m_bEnableFileLog) {
        return;
    }

	SYSTEMTIME st;		
	GetLocalTime(&st);
	if (0 > fprintf(m_hLogFile, "[%04u-%02u-%02u %02u:%02u:%02u:%03u] [%s] %s", 
		st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond, st.wMilliseconds, 
		LogLevelStr[Level], szBuffer)) {
		Dispose();
	}
	else {
		fflush(m_hLogFile);

        if (ftell(m_hLogFile) >= MAXLOGSIZE) {
            m_logFileCount++;
            MakeLogFilePath();
        }
	}
}
Beispiel #26
0
void ZFXModel::Log(const char *fmt, ...)
{
	char ch[1024];

	va_list args;
	va_start(args, fmt);
	vsprintf_s(ch, fmt, args);
	va_end(args);

	GetLogger().Print(ch);
}
Beispiel #27
0
void rtmp_log_output(int level, const char *format, va_list vl)
{
    int size = _vscprintf(format, vl);
    LPSTR lpTemp = (LPSTR)Allocate(size+1);
    vsprintf_s(lpTemp, size+1, format, vl);

   // OSDebugOut(TEXT("%S\r\n"), lpTemp);
    Log(TEXT("%S\r\n"), lpTemp);

    Free(lpTemp);
}
Beispiel #28
0
AnsiString Format(const char * Format, va_list Args)
{
  AnsiString Result(64, 0);
  if (Format && *Format)
  {
    intptr_t Len = _vscprintf(Format, Args);
    Result.SetLength(Len + 1);
    vsprintf_s(&Result[1], Len + 1, Format, Args);
  }
  return Result.c_str();
}
void MT_Logger::Log(char *format, ...)
{
	va_list args;
	va_start(args, format);

	char buffer[512];
	vsprintf_s(buffer, sizeof(buffer), format, args);
	OutputDebugStringA(buffer);

	va_end(args);
}
void warningMessage(const char *subsystem, const char *warningFormat, ...) {
    va_list args;
    char buffer1[300], buffer2[300];

    va_start(args, warningFormat);
    vsprintf_s(buffer1, sizeof(buffer1), warningFormat, args);
    va_end(args);

    sprintf_s(buffer2, sizeof(buffer2), "%s: %s", subsystem, buffer1);
    warningMessage_internal(buffer2);
}