Reading Extended Characters From Notepad

Hello All,
I am a new member to the forum but your posts have all been a huge help to me so far. This time I am stumped. I am attempting to use extended ascii characters to make large solid text in the console. I am in windows and using visual studio 2015(I have no choice this is the will of my school). I'm using an ascii code generator and I have not had any problems until trying to read in extended ascii codes from a notepad file and output them, more specifically codes like the ascii code 254 which is a solid box.
I can output the character by itself in the following format
char l = '█';
char m = 254;

int main()
{

cout << l << endl;// outputs a question mark
cout << m << endl;// outputs a █
system("pause");
}
Where I run into problems is attempting this. I am reading in a graphical menu made of ascii characters fyi..

#include <iostream>
#include <iomanip>
#include <fstream>
#include <iomanip>
#include <string>
#include <vector>
#include <numeric>
#include <algorithm>
using namespace std;
//********************************
// Input location for ifs stream *
//********************************
ifstream ifs("inputTest.txt");
//*********
// Vector *
//*********
char score;
vector<int> scores;
int r;
int h;
void enterNumbers()
{

if (ifs.is_open()) {

while (!ifs.eof())
{
commented out---//ifs >> static_cast<char>(score);//this didnt work either:(
ifs >> score ;
cout << score << endl;
scores.push_back(score);

}
system("pause");
}

for (int w = 0; w < scores.size(); w++)
{
cout << scores[w] << endl;

}
system("pause");

for (int i = 0; i < scores.size(); i++)
{
cout << static_cast<char>(scores[i] + '0') << endl;

}
system("pause");
These all give me junk output. I think Im not really understanding the whole string/string literal and how they are handled thing.

ANY INPUT AT ALL WOULD BE GREATLY APPRECIATED> ALL I WANT IS TO READ IN EXTENDED ASCII ART CHARACTERS TO CREATE A MENU OF SOLID CHARACTERS PER MY PROFESSOR WHO WONT TELL US HOW TO DO ITS REQUEST......

This is a short example of the first line of the txt file I am attempting to read in with my ifs >> code above

████████╗██╗ ██╗██████╗ ███████╗

The code will be used to create large letters for a menu. Thank you for any help you may generously offer.
Can you show us the contents of the file "inputTest.txt"?
████████╗██╗ ██╗██████╗ ███████╗
╚══██╔══╝╚██╗ ██╔╝██╔══██╗██╔════╝
██║ ╚████╔╝ ██████╔╝█████╗
██║ ╚██╔╝ ██╔═══╝ ██╔══╝
██║ ██║ ██║ ███████╗
╚═╝ ╚═╝ ╚═╝ ╚══════╝
You attempt to read them all and print them on the console window correct?
Sorry I cannot get it to format correctly : (
I would prefer to use a better way to output than console and what built into visual studio but that's what I'm allowed to use
above is not the exact text but close enough. It is saved in notepad
The whole point is I want to use things like an ascii art generator like the one on
http://patorjk.com/software/taag/#p=display&f=Graffiti&t=Type%20Something%20
and then put it into a text file and then output to the console for a game menu. I have been able to make non solid characters with ease but this has been frustrating me all day.
Last edited on
The first thing you need to do is to read all the text and print out each line on the console window?
Yes sir, that is correct. I can make that part work except the output puts out the wrong characters. I can fix the formatting later and I do not necessarily need to read from a file but thought it would be cool. Normally I put them into an array/vector and then output them line by line. The problem is I get a unicode message and then it outputs odd characters into the console
It will output things like a question mark into the console. The only way I am able to console output the ' █ ' character is by doing something like the following:
char m = 254;

int main()
{
cout << m << endl;
}
There is no way to print correctly unicode characters on Console Window, because Unicode support for Window Console is still limited.
I am able to out the characters to the console individually by calling the characters by their value like follows:

char m = 254;

int main()
{

cout << m << endl;
system("pause")

}
Topic archived. No new replies allowed.