March 28, 2024, 10:57:57 AM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


How to delete a line in console?

Started by kibalab, October 29, 2007, 09:24:55 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

kibalab

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?

GWS

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



Tomorrow may be too late ..

kibalab

I was searching for something like \r in C.

GWS

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
Tomorrow may be too late ..

kibalab

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

sapero

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);

kibalab

I tried this but it didn't work. Anyway I now use GWS' method (coded my own ConsoleLine "manager" ^^ I love this language :P).