[SOLVED]Load Bar -Creating a Square shape character

Ok so in some programs I see in there console programs (when they are loading) they might use something in the lines of a bar. Question is what is the square character they use? As it counts up in blocks so it's normally a full colored gray square? Or at the least that's what I thought it was. Creating the bar to load is easy enough. I just want to make it look neat with one of these square blocks haha.

Cheers
Last edited on
By looking it up as well I see it might possibly be they just fill up a space (" ") with the color gray etc. I'm just not sure how to actually do that?
You could also try these extended ASCII characters:

▒(177), ▓(178), or █(219)
Damn thats what I'm looking for but they come up as "?" -
warning C4566: character represented by universal-character-name '\u2593' cannot be represented in the current code page (1252)
Trying all the things I can find like it - but they are all getting the same error as above. Is there a way I can in a sence - Include the form of characters or define them or anything like that?
All good, figured it out with bar = bar + (char)219;
Keep in mind that that only works on Windows, so just changing the background color (with SetConsoleTextAttribute() ) would work.

If you really want to get fancy, you can increase the granularity with (char)221 to fill half a square.

Have fun!
Hmm I'm using http://www.cdrummond.qc.ca/cegep/informat/Professeurs/Alain/files/ascii.htm at the moment for all the different characters. But how exactly do you mean to use the half fill? You referring to changing the color of the string and use the (char)221 - so it would show half the color breaking through?
Ok so I'm using (char)221 now but. How exactly do i Get this to work:
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), ...?);
What do I put in the "...?" Section I've never used one of those before?
Oh wait hang on say I use something basic like: SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_GREEN); Is there anything else fancy I can do to it? Make it say multicolored or something? At the moment its the background is black and foreground is green. Anyway of changing the background of just that string that's being displayed?
Hmm, is it something like this that you mean - This is kind of like and ugly pretty haha. Is it possible to mix the colors?
Sorry about all the posting, just finding this a nifty Function. SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), (FOREGROUND_BLUE + BACKGROUND_GREEN)); Ok so I like how that looks but once its finished. How do I turn the Back and Fore Ground into its original colors?
All is good - thanks for the help Duoas.

1
2
3
4
#define WHITE 0x000F
#define BLACK 0x0000

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), (WHITE + BLACK));


I just used that to make it a nice white. Cheers for the help.

Thanks,
Myth.
Also, you can use the edit button to add stuff to your old posts ^^
Haha yeah I know, just got a little posting happy there :D
Topic archived. No new replies allowed.