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

📄 w_strcen.c

📁 [随书类]Dos6.0源代码
💻 C
字号:
/***************************************************************************/
/*																									*/
/*	W_STRCEN.C																					*/
/*                                                                         */
/*		Copyright (c) 1991 - Microsoft Corp.											*/
/*		All rights reserved.																	*/
/*		Microsoft Confidential																*/
/*                                                                         */
/* Returns the display column which cause the string passed as an argument */
/* to be displayed centered on the screen. 										   */
/*                                                                         */
/* int CenterStr( char *szString )														*/
/* 																								*/
/* ARGUMENTS:	szString - pointer to a string                              */
/* RETURNS: 	int column number which causes the string to be centered		*/
/*																									*/
/* johnhe - 03/15/89																			*/
/***************************************************************************/

#include		<string.h>
#include		<bios_io.h>

int CenterStr( char *szString )
{
	unsigned 					cch;
	extern unsigned char 	ScreenWidth;

   cch = strlen( szString );
	return( (int)(((VideoGetWidth() - cch) / 2) + (cch & 1 ? 1 : 0)) );
}

⌨️ 快捷键说明

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