| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 374 人关注过本帖
标题:关于本文窗口函数 void gettextinfo(struct text_info *f)的问题
只看楼主 加入收藏
jeff6197754
Rank: 2
等 级:论坛游民
帖 子:6
专家分:22
注 册:2014-5-25
结帖率:100%
收藏
已结贴  问题点数:6 回复次数:1 
关于本文窗口函数 void gettextinfo(struct text_info *f)的问题
有时需要知道当前屏幕的显示方式,当前窗口的坐标、当前光标的位置,文本的显示
属性等,Turbo C 提供了一些函数得到屏幕文本显示有关信息的函数:
void gettextinfo(struct text_info *f);
这里的text_info 是在conio.h 头文件中定义的一个结构,该结构的定义是
struct text_info{
unsigned char winleft;         /* 窗口左上角x 坐标 */
unsigned char wintop;         /* 窗口左上角y 坐标 */
unsigned char winright;         /* 窗口右下角x 坐标 */
unsigned char winbottom;     /* 窗口右下角y 坐标 */
unsigned char attributes;     /* 文本属性 */
unsigned char normattr;     /* 通常属性 */
unsigned char currmode;     /* 当前文本方式 */
unsigned char screenheight;     /* 屏高 */
unsigned char screenwidth;     /* 屏宽 */
unsigned char curx;         /* 当前光标的x 值 */
unsigned char cury;         /* 当前光标的y 值 */
};

然后,程序中:
程序代码:
cprintf("Left corner of window is %d,%d ",current.winleft,current.wintop);  
/*上面用的是char型变量*/
cprintf("Right corner of window is %d,%d ",current.winright,current.winbottom);
cprintf("Text window attribute is %d ",current.attribute);
cprintf("Text window normal attribute %d ",current.normattr);
cprintf("Current video mode is %d ",current.currmode);
cprintf("Window height and width is %d,%d ",current.screenheight,current.screenwidth);
cprintf("Row cursor pos is %d , Column pos is %d ",current.cury,current.curx);


问题:为什么定义的是char型,输出格式却是用%d?
搜索更多相关主题的帖子: 信息 
2014-05-30 00:34
砖家的谎言
Rank: 12Rank: 12Rank: 12
等 级:禁止访问
威 望:30
帖 子:693
专家分:3898
注 册:2013-12-6
收藏
得分:5 
很好好像跟VC里面不一样

我不是砖家,要努力成为砖家。
2014-05-30 11:08
快速回复:关于本文窗口函数 void gettextinfo(struct text_info *f)的问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.018418 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved