void PrintTxt(const char* fmt , ... ) { va_start( args, fmt ); vsprintf( buffer, fmt, args ); OutputDebugString( buffer ) ; } void PrintTxtDebug(const char* fmt , ... ) { #ifdef _DEBUG PrintTxt( fmt ) ;//此处崩溃! #endif } void PrintTxtAll(const char* fmt , ... ) { PrintTxt( fmt ) ;//此处崩溃! } 正确写法如下 void PrintTxt(const char* &fmt ) { va_start( args, fmt ); vsprintf( buffer, fmt, args ); OutputDebugString( buffer ) ; } void PrintTxtDebug(const char* fmt , ... ) { #ifdef _DEBUG PrintTxt( fmt ) ;//OK #endif } void PrintTxtAll(const char* fmt , ... ) { PrintTxt( fmt ) ;//OK }