Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Re: clrscr Compiler Independent functions

Thread Tools

Re: clrscr Compiler Independent functions

Jonathan Mcdougall
Posts: n/a
> I have been programming in C++ with borland compiler for a while now.
> But when I try to compile the same programs with other complilers like
> mingw, digital mars etc. there are problems with functions like
> getch() and clrscr().

That's what happens when you use non-standard functions.

> I have used these functions in many of my programs. Is there another
> funciton
> similer to these which are supported by other compilers?

For clrscr(), no. For getch(), you could use std::cin by specifying to
the user you want the enter key, though other characters will be echoed
to the screen.

In that kind of situation, it would have been better to encapsulate
these non standard calls to a single place, for example

void wait_for_key()

That way, when you change the compiler, you only have to change that

> I don't want
> to use
> system("pause") because I want the getch() function to return the key
> that was pressed. I use that in many of my programs.

Too bad.

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to clear screen (as clrscr in c) in java? vikaskumar sharma Java 9 10-07-2012 03:12 PM
Problem with clrscr() AHR C++ 3 08-07-2008 09:59 AM
library functions similar to gotoxy(),clrscr() etc. in gnu and otherc++ C++ 1 06-10-2008 06:58 PM
POSIX and getch(), clrscr() Michele 'xjp' C++ 8 07-27-2007 03:02 PM
Re: clrscr Compiler Independent functions Dfschweiss C++ 1 12-01-2004 11:38 AM