How to clear console without system("cls")

Pages: 12
Good to know. I was coding on DOS in the 80s and didn't really do anything with unix until the early 90s. I vaguely remember vt100 now that you said it, but I did so little I had to look them up every time I did one. I coded a couple of programs in VI over a terminal, but that was so bad that I figured out a way to do it on windows and paste it into the terminal and save it, I gave up trying to edit like that.
Last edited on
What would my pc need to do to be able to use
 
std::cout << "\x1B[2J\x1B[H";


Also this:
 
std::cout  << "\x1b[20;20H"; //I see this in some codes 


Is there a way that I can make it work???
Last edited on
Is system("mode con:cols=57 lines=25") //makes screen change size safe?

If not, what is an alternative?

Also, does this mean that Batch files are also not safe??
I have only heard about use in c++ not being safe.
Last edited on
batch files are not terribly safe, but they are NO WORSE than the attacker having the ability to type dos commands at a console with whatever level of permissions.

again, use of system(anything) is the problem, not 'cls'. So any code with system in it would fail if you ran it through a vulnerability check program, and could be hacked by a determined bad person.

I don't know another way to change screen size, but same as clear screen, there are probably 50 ways to do it. See if you can find something with a search as we did for clear screen. If you can't, I can try to look it up and play with it but I am busy this week.

I don't know why your winx can't run the vt codes. I will research that when I can as it is odd. In the meantime, make sure you have all the updates.
Last edited on
Ok, thanks. I will try some searches.
No luck on the vt code thing, they work with the 3ds homebrews I make.
But I found this:
http://www.cplusplus.com/forum/beginner/1481/
See my previous post. VT100 code support was introduced into Windows 10 during 2018 (forgot which release). See https://docs.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences They don't work with earlier versions of Windows 10 (or Windows 7 or Windows 8/8.1).
Topic archived. No new replies allowed.
Pages: 12