我想用一个FormatCString.h 和FormatCString.cpp
把字符串格式化封装 ,
FormatCString.h
////////
#ifndef __HB_FORMATCSTRING__
#define __HB_FORMATCSTRING__TCHAR * CDECL FormatCString (TCHAR * szFormat, ...) ;#endif __HB_FORMATCSTRING__
/////////
FormatCString.cpp
///////
#include "FormatCString.h"TCHAR * CDECL FormatCString (TCHAR * szFormat, ...)
{
static TCHAR szBuffer[1024] ;
va_list pArgList ; // The va_start macro (defined in STDARG.H) is usually equivalent to:
// pArgList = (char *) &szFormat + sizeof (szFormat) ; va_start(pArgList, szFormat) ; // The last argument to wvsprintf points to the arguments _vsntprintf (szBuffer, sizeof (szBuffer) / sizeof (TCHAR),
szFormat, pArgList) ; // The va_end macro just zeroes out pArgList for no good reason va_end (pArgList) ; return szBuffer ;
}
//////////
出现了
fatal error c1010:在查找预编译头指令时遇到的文件结尾求助呀!急!
把字符串格式化封装 ,
FormatCString.h
////////
#ifndef __HB_FORMATCSTRING__
#define __HB_FORMATCSTRING__TCHAR * CDECL FormatCString (TCHAR * szFormat, ...) ;#endif __HB_FORMATCSTRING__
/////////
FormatCString.cpp
///////
#include "FormatCString.h"TCHAR * CDECL FormatCString (TCHAR * szFormat, ...)
{
static TCHAR szBuffer[1024] ;
va_list pArgList ; // The va_start macro (defined in STDARG.H) is usually equivalent to:
// pArgList = (char *) &szFormat + sizeof (szFormat) ; va_start(pArgList, szFormat) ; // The last argument to wvsprintf points to the arguments _vsntprintf (szBuffer, sizeof (szBuffer) / sizeof (TCHAR),
szFormat, pArgList) ; // The va_end macro just zeroes out pArgList for no good reason va_end (pArgList) ; return szBuffer ;
}
//////////
出现了
fatal error c1010:在查找预编译头指令时遇到的文件结尾求助呀!急!
你也可以不采用预处理头文件,方法是:
Project -> Settings -> C++ -> Precompiled headers -> Not using precompiled headers