Forum Topic: C++ :Show percentage done

(167 views • 8 replies)

This topic is 1 page long.

<< < > >>
Happy

WhoknowsmeaUdiO

Reply To Post Reply & Quote

Posted at: 6/30/09 02:41 PM

WhoknowsmeaUdiO DARK LEVEL 13

Sign-Up: 04/11/07

Posts: 1,170

Hello there, I haven't got any programming expierence aside from AS2 and I've started out with C++ 2 days ago.

Yes, I used the search.

What I'm trying to do, is show: "78% done", with the percentage increasing. Now, I know how to do this, but I do not know how to make it NOT start a new line everytime.
I know how to do:

1% done
2% done
3% done

etc....

I want to do:

1% done

But with 1 % increasing every x milliseconds (not necessarily actually something loading) and staying on one line.

I hope that someone can help me and that I did not explain too vaguely.

In case you haven't noticed yet, this isn't my main anymore. PM me here.

BBS Signature

None

kiwi-kiwi

Reply To Post Reply & Quote

Posted at: 6/30/09 02:47 PM

kiwi-kiwi LIGHT LEVEL 08

Sign-Up: 03/06/09

Posts: 631

system("cls") ?


None

WhoknowsmeaUdiO

Reply To Post Reply & Quote

Posted at: 6/30/09 02:50 PM

WhoknowsmeaUdiO DARK LEVEL 13

Sign-Up: 04/11/07

Posts: 1,170

Thanks, but is there also a way to just delete a certain line, I'd prefer that.

In case you haven't noticed yet, this isn't my main anymore. PM me here.

BBS Signature

None

kiwi-kiwi

Reply To Post Reply & Quote

Posted at: 6/30/09 03:07 PM

kiwi-kiwi LIGHT LEVEL 08

Sign-Up: 03/06/09

Posts: 631

Well, you could copy everything you have in the console, remove the last line, clear screen and then print


None

WhoknowsmeaUdiO

Reply To Post Reply & Quote

Posted at: 6/30/09 03:10 PM

WhoknowsmeaUdiO DARK LEVEL 13

Sign-Up: 04/11/07

Posts: 1,170

At 6/30/09 03:07 PM, kiwi-kiwi wrote: Well, you could copy everything you have in the console, remove the last line, clear screen and then print

So no automatic way. Anyways, thx.

In case you haven't noticed yet, this isn't my main anymore. PM me here.

BBS Signature

None

CronoMan

Reply To Post Reply & Quote

Posted at: 6/30/09 03:22 PM

CronoMan EVIL LEVEL 06

Sign-Up: 07/19/04

Posts: 2,978

At 6/30/09 03:10 PM, WhoknowsmeaUdiO wrote:
At 6/30/09 03:07 PM, kiwi-kiwi wrote: Well, you could copy everything you have in the console, remove the last line, clear screen and then print
So no automatic way. Anyways, thx.

You need to move the cursor back to the position where you printed the percentage
On windows, you use SetConsoleCursorPosition from Win32 (console api reference here)
On Unix you need to use curses or ncurses

"no sound in ass"


None

CronoMan

Reply To Post Reply & Quote

Posted at: 7/1/09 08:59 AM

CronoMan EVIL LEVEL 06

Sign-Up: 07/19/04

Posts: 2,978

And don't use clearscreen, as that will make the screen flicker
if you must use clearscreen, do it in a seperate backbuffer (page)

"no sound in ass"


None

henke37

Reply To Post Reply & Quote

Posted at: 7/1/09 10:27 AM

henke37 NEUTRAL LEVEL 23

Sign-Up: 09/10/04

Posts: 3,553

Conclusion, stdout sucks. Stick to the real console api instead. And please, avoid system at all costs.

Each time someone abuses hittest, God kills a kitten. Please, learn real collision testing.


None

jmbpiano

Reply To Post Reply & Quote

Posted at: 7/4/09 03:59 AM

jmbpiano NEUTRAL LEVEL 03

Sign-Up: 07/04/09

Posts: 7

There is no "standard" way of doing this sort of thing in C/C++. The way you will end up doing it depends entirely on what compiler you use and what OS you're writing the program for. Are you doing this on Linux, Windows, Mac, DOS? What compiler are you using?


All times are Eastern Standard Time (GMT -5) | Current Time: 08:51 AM

<< Back

This topic is 1 page long.

<< < > >>
You need a Grounds Gold Account to post on the NG BBS! If you don't have one, click here to sign up now! It's fast, free, and easy — and opens up tons of great NG features!