Display the 219 Ascii block like turbo c++

Started by
5 comments, last by benryves 14 years, 1 month ago
Still struggling to find a way to make the compilers i use (either dev c++ occasionally and vis 2008 though not much) display the ascii block 219 (or 2588) as it is shown here http://ascii-table.com/ascii-extended-pc-list.php its about just over half way down.and looks like this -- >> █ but this of course does not copy paste into dev c++. It does copy paste into vis 2008 but i cant make that compile anything that i do because of an error i cant get round that asks for the exe when it doesnt exist (and no it cant be sorted because i have looked at every possible working solution to this problem and none of them solved it). I am sure it can be done as i have seen the install screen for turbo c++ and it has all the pipes and bars to jazz up the install process (like 2544, and 2567 etc) So is there a way to display the 219 block at all using cout? I have seen many programs that convert ascii into intergers and so on but im not interested in them as i want to actually display just one block, just that 219 block. I have tried alt - (enter number here) like how alt - 0149 displays the • dot, but what displays the block?
Advertisement
You should be able to specify the octal or hex value in a string or char literal using the appropriate escape sequences.
have you tried:

char c = 219;

?
Comrade, Listen! The Glorious Commonwealth's first Airship has been compromised! Who is the saboteur? Who can be saved? Uncover what the passengers are hiding and write the grisly conclusion of its final hours in an open-ended, player-driven adventure. Dziekujemy! -- Karaski: What Goes Up...
Quote:
So is there a way to display the 219 block at all using cout?

std::cout << (unsigned char)219;

However, since this is a high-order ASCII character, what that actually displays depends on the how the high-order ASCII set is mapped in your implementation, by default. It may work, it may not. If it doesn't you'll need to change the mapping.

It appears to work by default using Visual Studio.
Quote:Original post by jpetrie
It appears to work by default using Visual Studio.
It will depend on your current code page, which in turn depends on the version (language version, that is) of Windows you're using. Use SetConsoleOutputCP to set the code page; 850 has that particular block graphic, as does 437.

[Website] [+++ Divide By Cucumber Error. Please Reinstall Universe And Reboot +++]

This works fine

std::cout << (unsigned char)219;

Thank you very much. I have no idea where i went wrong but this displays no problems.
Quote:Original post by Somarl
This works fine

std::cout << (unsigned char)219;

Thank you very much. I have no idea where i went wrong but this displays no problems.
You still should set the output code page. For example, a Russian computer may use code page 1251* (as opposed to the UK default which is 850), which produces a different character for 219:

#include <windows.h>#include <iostream>int main() {	SetConsoleOutputCP(1251);	std::cout << (char)219 << std::endl; // Outputs "&#1067;" instead of a block.	SetConsoleOutputCP(850);	std::cout << (char)219 << std::endl; // Outputs a block, as you expected.}


_________________________________
* I don't know what the default is for Russian, but it's an example.

[Website] [+++ Divide By Cucumber Error. Please Reinstall Universe And Reboot +++]

This topic is closed to new replies.

Advertisement