⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 myprintf.c

📁 游戏编程精华02-含有几十个游戏编程例子
💻 C
字号:
/* Copyright (C) Steven Woodcock, 2001. 
 * All rights reserved worldwide.
 *
 * This software is provided "as is" without express or implied
 * warranties. You may freely copy and compile this source into
 * applications you distribute provided that the copyright text
 * below is included in the resulting source code, for example:
 * "Portions Copyright (C) Steven Woodcock, 2001"
 */
//*********************************************************************
// Name:     myprintf.c
// Purpose:  A simple debugging version of printf that dumps data
//           to a text file.
//*********************************************************************

//
// includes
//

#include <io.h>
#include <stdio.h>
#include <stdarg.h>

// globals

//extern char OutputFileName[];

int myprintf( char *str, ... ) {

   char buf[256];
   va_list vlist;

   static FILE *dbg;

   /* File section */

   if ( dbg == NULL ) {
      dbg = fopen("C:/windows/desktop/SimpleFlocking.txt", "w" );
      if ( dbg == NULL ) return 0;
   }

   va_start( vlist, str );
   vsprintf( buf, str, vlist );
   va_end( vlist );

   fprintf(dbg, "%s", buf );
   fflush(dbg);

   return 0;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -