Standardio: clearing the console output

BlitzMax Forums/BlitzMax Beginners Area/Standardio: clearing the console output

byo(Posted 2009) [#1]
Hi, guys.

I've tried searching the forums and google and couldn't find anything like it.

How can you clear the output from a console window? Like old DOS command 'cls'.

Can this be done?

Thanks. :)


Jesse(Posted 2009) [#2]
not possible.


B(Posted 2009) [#3]
damn...


:P


xlsior(Posted 2009) [#4]
How can you clear the output from a console window? Like old DOS command 'cls'


You can print a bunch of blank lines which essentially scrolls it out of view, but if people have a larger buffer enabled then you still have the ability to scroll back up to see the info.


Brucey(Posted 2009) [#5]
You can print a bunch of blank lines which essentially scrolls it out of view

Heh :-)

not possible.

Of course it is!

How can you clear the output from a console window?

A console or *the* BlitzMax console?

From the BlitzMax console... no, you can't.

From a console window - like a DOS box or Mac/Linux Terminal window - yes, you can. But you need to know what special escape sequences you need to send to it.


skidracer(Posted 2009) [#6]
I don't think Microsoft has supported ANSI since win98.


byo(Posted 2009) [#7]
@Brucey: yes, I was talking about the standardio functions Print and Input. I was only using them in my application without any GUI like a command-line tool.

Thanks for the advices, guys.

The problem is I'm making this command-line tool that allows the user to type in a password before having access to its features. But after the user logs in I want to remove the password from the screen, clearing what was typed.

Are there no workarounds? :(

Thanks again.


TaskMaster(Posted 2009) [#8]
Accept the keystrokes without printing them, then just print asterisks.


byo(Posted 2009) [#9]
But how exactly? With getchar?
Sorry about the question. That's why I've asked on the beginner's forum even though I knew it wasn't possible using only standardio. :)

I'm not sure how to begin. Which module should I use? Which functions should I use?

Thanks in advance.


Nate the Great(Posted 2009) [#10]
maybe you could do thousands of blank lines... the scroll bar has a limit so then even if you did scroll to the top, it wwould be gone


Brucey(Posted 2009) [#11]
HERE is a little Windows app made in BlitzMax. You need to run it from the console/cmd.

Possibly the kind of control over the console you are looking for...


EOF(Posted 2009) [#12]
This will do the trick
It only works on the runtime console window so you won't see anything happening in the Blitz IDE output

Windows only




byo(Posted 2009) [#13]
Nice code.
Thank you all.


otttto(Posted 2016) [#14]
Win7 not function.........


grable(Posted 2016) [#15]
If you only need to change the last line, using ~r alone is quite nice. Can rewrite the last line, making progress bars and such easy.

This doesnt work for the standard inputs though, so need to role your own. One which doesnt echo the newline specifically.

NOTE: This only works directly in a console.


Oh, and if your on Windows 10 the Console supports basic ANSI now, which makes all this much easier ;)


Derron(Posted 2016) [#16]
"_getch" is not available here on my box (linux, gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.3) ).


bye
Ron


Brucey(Posted 2016) [#17]
"getch" should be.