> 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
function.
> 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.
Jonathan
|