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

📄 wcenters.c

📁 详细介绍了一篇关于pci开发的接口芯片
💻 C
字号:
/*  CXL - Copyright (c) 1987-1989 by Mike Smedley - All Rights Reserved  */
/*  WCENTERS.C  - displays a string in centered in active window  */

#include <string.h>
#include "cxlvid.h"
#include "cxlwin.h"

int wcenters(int wrow,int attr,char *str)
{
    register int window_width,string_length;
    int start_column,border;

    /* check for active window */
    if(!_winfo.total) return(_winfo.errno=W_NOACTIVE);

    /* check for valid row */
    if(wchkcoord(wrow,0)) return(_winfo.errno=W_INVCOORD);

    /* check for window border */
    border=_winfo.active->border;

    /* calculate start column & window width */
    start_column=_winfo.active->scol+border;
    window_width=(_winfo.active->ecol-border)-start_column+1;

    /* check length of input string */
    string_length=strlen(str);
    if(string_length>window_width) return(_winfo.errno=W_STRLONG);

    /* display the string */
    prints(_winfo.active->srow+wrow+border,
          ((window_width/2)+start_column)-(string_length/2),attr,str);

    /* return normally */
    return(_winfo.errno=W_NOERROR);
}

⌨️ 快捷键说明

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