开发者

clrscr()not working in VC++(VS 2008).....?

In VS 2008, I created an empty proje开发者_如何学Pythonct in VC++ and added a source file as . . .

`

 #include<stdio.h>    

 #include<conio.h>

int main()
{
  ....
  clrscr();
  .....
  return 0;
}

`

I get these errors/warnings :

Warning 1 warning C4013: 'clrscr' undefined; assuming extern returning int c:\tc\toh.c 170 TOH

Error 3 error LNK2019: unresolved external symbol _clrscr referenced in function _main TOH.obj TOH

What the problem??

Thanks in advance..


Are you trying to mix Borland libraries with VC++? That could be the problem. Can you clear the console instead by sending a bunch of \ns?


Use the FillConsoleOutputCharacter and FillConsoleOutputAttribute functions. There is even an example of how to do that at MSDN, convenniently called "Clearing the screen"


The problem is that conio from c++ do not have the clrscr like the conio from c native lib!!

Alternatively, you can use system("cls") instead clrscr(). Its not the best solution, but in my case I was just testing an old program and trying to solve that problem was getting me angry!! lol

#define clrscr(); system("cls");

It will keep your code and automatically change all clrscr(). You can do one by one, if you want.

Maybe you also need to include stdlib if something goes wrong

#include <stdlib.h>


Instead of using clrscr(); use system("cls");

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜