Replace system functions

Hi there! I'm kind of new to C++ and I'm wondering:

Is there any way to replace the system functions?

Like the system("CLS") and system("COLOR") ?

If there is, how do I do it?

Thanks // Mackan90096
There are many ways but there's no standard way. You can use libraries such as ncurses, or use system-specific functions.

Check out this article for how to clear console screen: http://www.cplusplus.com/articles/4z18T05o/

just use "clrscr();" under header file conio.h to clear user screen
The article Null pointed you at already provides an example of "CLS", including the Win32 approach.

Microsoft also provide a similar example:

Clearing the Screen
http://msdn.microsoft.com/en-us/library/windows/desktop/ms682022%28v=vs.85%29.aspx

For "COLOR", see these articles

Add color to your console 2
http://www.cplusplus.com/articles/Eyhv0pDG/

and its predecessor

Add color to your console window
http://www.cplusplus.com/articles/2ywTURfi/

and maybe these posts

C++ Change CMD color background and text
http://www.cplusplus.com/forum/beginner/49203/#msg267401

http://www.cplusplus.com/user/m4ster_r0shi/
http://www.cplusplus.com/forum/beginner/21809/#msg113936

Coloured letters in output
http://www.cplusplus.com/forum/beginner/77879/#msg426847

Andy

PS @ anandkrishnan

There's no clrscr in the conio.h that's provided with Visual C++. Nor in the one provided with the MinGW version of GCC. To the best of my knowledge, clrscr is unique to Borland's C runtime library.
Last edited on
Ok. Thanks for all the help!
Topic archived. No new replies allowed.