您的位置:首页 > 运维架构 > Linux

Linux控制界面文字显示位置

2016-07-18 18:10 411 查看
如果编译不了,或许是因为Linux没有安装curses包
/*
============================================================================
Name        : iconv.c
Author      :
Version     :
Copyright   : Your copyright notice
Description : Hello World in C, Ansi-style
============================================================================
*/

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <curses.h>

int mian()
{
initscr();// 开始图形模式
noecho();// 不回显
char temp[128];
char s[128];
int seq = 0;

while (scanf("%s", s))
{
if (strcmp(s, "exit") == 0)
break;
clear();// 清除屏幕
sprintf(temp, "please input:");
mvaddstr(0, 0, temp);// 在指定的坐标打印
int i;
for (i = 0; i < 10; i++)
{
sprintf(temp, "%s %d %s", s, seq++, s);
mvaddrstr(i + 1, 0, temp);
}
move(0, 13);// 移动光标到指定坐标
refresh();// 刷新屏幕,如果不刷新屏幕,那么mvaddstr和move将不生效
}
endwin();// 结束图形模式
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: