pprintf.c

来自「使用于OS/2下的小工具的C源程序,使用于OS/2下的小工具的C源程序」· C语言 代码 · 共 50 行

C
50
字号
/*
* PPRINF.C - Pageprintf routine enables us to handle the /P option in each
*	    command. It gives the printf interface out and prints the text
*	    'Press any key' and requires a key each time the screen is full of text.
*
* PROGRAMMER:	    Martti Ylikoski
* CREATED:	    2.11.1991
* VERSION:	    1.0
*
*/
#undef MSDOS
#include <stdio.h>
#include <stdarg.h>
#include "pprintf.h"
#ifndef MSDOS
#define INCL_KBD
#include <os2.h>
#endif
#include <param.h>
#include <paramstd.h>
extern unsigned long pflags ;
int Pageprintf(int rows, char *fmt, ...)
{
va_list marker ;
char buf[512] ;
int ret ;
static int outlines = 0 ;
#ifndef MSDOS
KBDKEYINFO kbci ;
#endif
   va_start(marker, fmt) ;
   ret = vsprintf(buf, fmt, marker) ;
   va_end( marker ) ;
   fputs(buf, stdout) ;
   outlines ++ ;
   if ((pflags & PA_PAUSE) && (outlines >= rows) )
   {
#ifdef MSDOS
      fputs("Press ENTER key when ready ...", stdout) ;
      getchar() ;
#endif
#ifndef MSDOS
      fputs("Press any key when ready ...", stdout) ;
      KbdCharIn(&kbci, IO_WAIT, 0) ;
      puts("") ;
#endif
      outlines = 0 ;
   }
}

⌨️ 快捷键说明

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