标题:清屏问题 in c-free
只看楼主
神vLinux飘飘
Rank: 13Rank: 13Rank: 13Rank: 13
来 自:浙江杭州
等 级:贵宾
威 望:91
帖 子:6140
专家分:217
注 册:2004-7-17
得分:0 
你把#include <conio.h>改成#include <conio.c>看看

淘宝杜琨
2006-05-10 21:43
justicesun
Rank: 1
等 级:新手上路
帖 子:94
专家分:0
注 册:2006-5-6
得分:0 
以下是引用神vLinux飘飘在2006-5-10 21:43:00的发言:
你把#include <conio.h>改成#include <conio.c>看看

ok....谢谢!那就继续用c-free了,不tc了...


Java
2006-05-10 21:46
justicesun
Rank: 1
等 级:新手上路
帖 子:94
专家分:0
注 册:2006-5-6
得分:0 
可是为什么啊??

Java
2006-05-10 21:48
论坛
Rank: 3Rank: 3
等 级:新手上路
威 望:6
帖 子:1372
专家分:0
注 册:2006-3-27
得分:0 
我倒,你管它为什么干嘛

日出东方,唯我不败! 做任何东西都是耐得住寂寞,任何一个行业要有十年以上的积累才能成为专家
2006-05-10 21:49
神vLinux飘飘
Rank: 13Rank: 13Rank: 13Rank: 13
来 自:浙江杭州
等 级:贵宾
威 望:91
帖 子:6140
专家分:217
注 册:2004-7-17
得分:0 
呵呵,c-free中的conio.h好多都没实现~conio.c才是实现好的源文件,你可以看到源代码

淘宝杜琨
2006-05-10 21:59
justicesun
Rank: 1
等 级:新手上路
帖 子:94
专家分:0
注 册:2006-5-6
得分:0 
哦...谢!

Java
2006-05-10 22:02
神vLinux飘飘
Rank: 13Rank: 13Rank: 13Rank: 13
来 自:浙江杭州
等 级:贵宾
威 望:91
帖 子:6140
专家分:217
注 册:2004-7-17
得分:0 

#ifndef _CONIO_C_
#define _CONIO_C_

/* Please keep all functions alphabetical! */

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <windows.h>
#include "conio.h"

int __FOREGROUND = LIGHTGRAY;
int __BACKGROUND = BLACK;

void _setcursortype(int _type) {
CONSOLE_CURSOR_INFO Info;
Info.bVisible = TRUE;
if (_type == _NOCURSOR)
Info.bVisible = FALSE;
else if (_type == _SOLIDCURSOR)
Info.dwSize = 100;
else if (_type == _NORMALCURSOR)
Info.dwSize = 1;
SetConsoleCursorInfo (GetStdHandle (STD_OUTPUT_HANDLE), &Info);
}

void clreol() {
/* What does this function do? */
}

void clrscr() {
COORD coord;
DWORD written;
CONSOLE_SCREEN_BUFFER_INFO info;

coord.X = 0;
coord.Y = 0;
GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &info);
FillConsoleOutputCharacter (GetStdHandle(STD_OUTPUT_HANDLE), ' ',
info.dwSize.X * info.dwSize.Y, coord, &written);
gotoxy (1, 1);
}

int cputs(const char *_str) {
printf ("%s\n", _str);
return 0;
}

int getche() {
int ch;
ch = getch ();
printf ("%c\n", ch);
return ch;
}

void gettextinfo(struct text_info *_r) {
CONSOLE_SCREEN_BUFFER_INFO Info;
GetConsoleScreenBufferInfo (GetStdHandle (STD_OUTPUT_HANDLE), &Info);
_r->winleft = Info.srWindow.Left;
_r->winright = Info.srWindow.Right;
_r->wintop = Info.srWindow.Top;
_r->winbottom = Info.srWindow.Bottom;
_r->attribute = Info.wAttributes;
_r->normattr = LIGHTGRAY | BLACK;
/* _r->currmode = ; */ /* What is currmode? */
_r->screenheight = Info.dwSize.Y;
_r->screenwidth = Info.dwSize.X;
_r->curx = wherex ();
_r->cury = wherey ();
}

void gotoxy(int x, int y) {
COORD c;
c.X = x - 1;
c.Y = y - 1;
SetConsoleCursorPosition (GetStdHandle(STD_OUTPUT_HANDLE), c);
}

void gppconio_init() {
/* Do nothing */
}

void highvideo() {
if (__FOREGROUND <= BROWN)
textcolor (__FOREGROUND + 9);
if (__BACKGROUND <= BROWN)
textbackground (__BACKGROUND + 9);
}

void insline() {
printf ("\n");
}

int putch(int _c) {
printf ("%c", _c);
return _c;
}

void textattr(int _attr) {
SetConsoleTextAttribute (GetStdHandle(STD_OUTPUT_HANDLE), _attr);
// printf ("%d\n", text_info.screenheight);
}

void textbackground(int _color) {
if (_color == BLINK)
_color = WHITE;
__BACKGROUND = _color;
textattr (__FOREGROUND | (_color + 29));
}

void textcolor(int _color) {
if (_color == BLINK)
_color = WHITE;
__FOREGROUND = _color;
textattr(_color | __BACKGROUND);
}

int wherex() {
CONSOLE_SCREEN_BUFFER_INFO info;
GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &info);
return info.dwCursorPosition.X;
}

int wherey() {
CONSOLE_SCREEN_BUFFER_INFO info;
GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &info);
return info.dwCursorPosition.Y - 2;
}

void window(int _left, int _top, int _right, int _bottom) {
SMALL_RECT R;
R.Left = _left;
R.Top = _top;
R.Right = _right;
R.Bottom = _bottom;
SetConsoleWindowInfo (GetStdHandle(STD_OUTPUT_HANDLE), TRUE, &R);
gotoxy (_left, _top);
}

#endif _CONIO_C_


淘宝杜琨
2006-05-10 22:02
justicesun
Rank: 1
等 级:新手上路
帖 子:94
专家分:0
注 册:2006-5-6
得分:0 

我多么希望我能读懂它....


Java
2006-05-10 22:09



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-63131-1-1.html




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

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