w_center.c
资源名称:DOS系统的源代码.rar [点击查看]
上传用户:xiaoan1112
上传日期:2013-04-11
资源大小:19621k
文件大小:1k
源码类别:
操作系统开发
开发平台:
Visual C++
- /***************************************************************************/
- /* */
- /* W_CENTER.C */
- /* */
- /* Copyright (c) 1991 - Microsoft Corp. */
- /* All rights reserved. */
- /* Microsoft Confidential */
- /* */
- /* Function to return the starting column of a string consisting of StrLen */
- /* number of characters for the string to be centered on a line of the */
- /* current screen. The function will adjust current width of the screen. */
- /* */
- /* int CenterLength( int iStrLen ) */
- /* */
- /* ARGUMENTS: int iStrLen - The lenght of a string to be centered on */
- /* the current display. */
- /* RETURNS: int - Starting column to make the string centered */
- /* */
- /* johnhe - 03/15/89 */
- /***************************************************************************/
- #include <bios_io.h>
- int CenterLength(int iStrLen)
- {
- extern unsigned char ScreenWidth;
- return( ((VideoGetWidth() - iStrLen) / 2) + (iStrLen & 1 ? 1 : 0) );
- }