victor gatto
victor gatto

Reputation: 61

Clearing the console with c++ in windows

I have read a few articles online about clearing the console with c++ in windows by using system("cls");

A few people told me using system commands isn't practical and it may be unsafe.

I would like to know why, seeing as i'm building a little console program for uni that has a menu at the start.

Is it perfectly safe and professional to use system("cls"); at home and in the workforce?

Upvotes: 1

Views: 5324

Answers (1)

Arun
Arun

Reputation: 2092

Please note: The command "cls" is windows specific. The counterpart on Linux systems is command "clear". Hence system("cls") is not portable.

Prefer curses library as it is cross-platform. Want to quick (hacky?) way, look at clear the screen!

Also, have a look at How do you clear console screen in C?

Upvotes: 1

Related Questions