Filling console with ASCII

Started by
3 comments, last by h8CplusplusGuru 6 years, 5 months ago

Hi,

I'm trying to fill a win64 Console with ASCII char.

At the moment I have 2 solutions: one using std::cout for each line, let's say 30 lines at once using std::endl at the end of each one.

The second solution is using FillConsoleOutputCharacter. This method seems a lot more robust and with less flickering. But I'm guessing, internally it's using a different table than the one used by std::cout. I'm trying to fill the console with the unsigned char 0xB0 which is a sort of grey square when I use std::cout but when using FillConsoleOutputCharacter it is outputted as the UTF8 char '°'.

I tried using SetConsoleOutputCP before but could not find a proper way to force it to only use the non-extended ASCII code page...

Has anyone a hint on this one?

Cheers!

Advertisement

Well, this really depends on which function youre using.. if you use "FillConsoleOutputCharacter" or "FillConsoleOutputCharacterW" it would allow the degree character .. using "FillConsoleOutputCharacterA" should use the same set of character that cout is using .. so that should cause it to fill it with the square

Cheers, this is perfect!

I did not think about this, simple and very efficient! Thank you.

there shouldn't be any flickering with FillConsoleOutput, check that your'e dimensions are right. I recently was doing work with this and the dimension variable i was querying had a height of like 900, which caused mad flicker. The dimension struct has a couple different dimension members, get the right one and do +1 i think. 

This topic is closed to new replies.

Advertisement