IonicWind Software

Aurora Compiler => General Discussion => Topic started by: kibalab on October 29, 2007, 09:24:55 AM

Title: How to delete a line in console?
Post by: kibalab on October 29, 2007, 09:24:55 AM
My program shall write

Calculating [Number] /

Then delete the line and write

Calculating [Number] -

Then delete again and write

Calculating [Number] \

Then

Calculating [Number] |

etc.

How to do?
Title: Re: How to delete a line in console?
Post by: GWS on October 29, 2007, 10:05:08 AM
Hi Kiba,

Console programs are very limited as a user interface.

You can clear the whole screen using 'CLS' and write stuff again .. a bit of a sledgehammer approach ..  :)

or you can use 'LOCATE y,x' to position where you will print - and overwrite what was there before .. so you could 'backtrack on what you wrote previously.

The only other thing is to place a comma at the end of a print line to keep printing on the same line.

Those are your only options I think .. probably the 'LOCATE y,x' being the most useful.

If you want more control over colors and user presentation, consider using a simple window instead .. they are not too difficult to use, and look much nicer ..  :)

all the best,

Graham



Title: Re: How to delete a line in console?
Post by: kibalab on October 29, 2007, 10:21:01 AM
I was searching for something like \r in C.
Title: Re: How to delete a line in console?
Post by: GWS on October 29, 2007, 11:17:31 AM
Hi,

I just noticed I'm off limits here in Aurora territory ..  :)

I've posted a small example in the Creative Basic Console section to illustrate the use of 'Locate y,x'.
I imagine it will be much the same in Aurora ..  :)

Graham
Title: Re: How to delete a line in console?
Post by: kibalab on October 29, 2007, 11:22:19 AM
Thank you, but I think I won't write my tiny program from scratch just to implement that little cosmetics  ;)
It's a math science program so beauty is very unimportant  :P
Title: Re: How to delete a line in console?
Post by: sapero on October 29, 2007, 05:56:44 PM
in C, \r is compilled as \13 or \x0d, so try thisprint("position is ", counter, "\x0d",)
// or
printf("position is %d\x0d", counter); // #include "stdio.inc"
// or
printf("position is %d%c", counter, 13);
Title: Re: How to delete a line in console?
Post by: kibalab on October 29, 2007, 06:01:08 PM
I tried this but it didn't work. Anyway I now use GWS' method (coded my own ConsoleLine "manager" ^^ I love this language :P).