By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,714 Members | 1,363 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,714 IT Pros & Developers. It's quick & easy.

A question about my C++ program and MSWindows :)

P: n/a
As I wrote the subject of this message, I got a cold feeling about this
question, I have realized that this is not only a programmer question,
but it is also a question about one the most detestable operation
systems in the market, but I will post it anyway, hoping that I will
not get fertilized by the any one here.

So, my question about a program that will display some text on the
console, not a big deal, the only thing is that the text displayed will
have some character that are not ASCCI; like the letter 'o' with two
dots on it or the letter '', (ALT-160/161/162, ETC). I don't have
much experience programming in MSW, thus I don't know how to handle
this problem.
Any help will be most appreciated.

TIA

Oct 12 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
jalkadir wrote:
...
So, my question about a program that will display some text on the
console, not a big deal, the only thing is that the text displayed will
have some character that are not ASCCI; like the letter 'o' with two
dots on it or the letter '', (ALT-160/161/162, ETC). I don't have
much experience programming in MSW, thus I don't know how to handle
this problem.
Try this.

#include <stdio.h>
#include <stdlib.h>
int main()
{
system("chcp 437 > nul");
printf("%c %c %c \n", 160, 161, 162);
return 0;
}
...


Oct 12 '05 #2

P: n/a
jalkadir wrote:
As I wrote the subject of this message, I got a cold feeling about this
question, I have realized that this is not only a programmer question,
but it is also a question about one the most detestable operation
systems in the market, but I will post it anyway, hoping that I will
not get fertilized by the any one here.

So, my question about a program that will display some text on the
console, not a big deal, the only thing is that the text displayed will
have some character that are not ASCCI; like the letter 'o' with two
dots on it or the letter '', (ALT-160/161/162, ETC). I don't have
much experience programming in MSW, thus I don't know how to handle
this problem.
Any help will be most appreciated.

TIA


You might be able to print wide unicode characters if you had a wide
stream for the cout. I don't know if it can handle this.

#include <iostream>

wchar_t ch = 0xC4;
std::cout << ch;

Doesn't print A umlaut on msys under Windows, and other than that, I
don't know of any way of printing to console.

There is no 'terminal' in standard C++. This is an OS specific issue,
and better addressed in an OS specific newsgroup.

--John Ratliff
Oct 12 '05 #3

P: n/a
jalkadir wrote:
As I wrote the subject of this message, I got a cold feeling about this
question, I have realized that this is not only a programmer question,
but it is also a question about one the most detestable operation
systems in the market, but I will post it anyway, hoping that I will
not get fertilized by the any one here.

So, my question about a program that will display some text on the
console, not a big deal, the only thing is that the text displayed will
have some character that are not ASCCI; like the letter 'o' with two
dots on it or the letter '', (ALT-160/161/162, ETC). I don't have
much experience programming in MSW, thus I don't know how to handle
this problem.
Any help will be most appreciated.

TIA


I think replacing the gratuitous editorializing with an actual question
would have made a better use of those bytes. Yes, the C++ program can
send non-ASCII characters to the "terminal" (or more precisely, to
std::cout which is usually directed to a tty device). The character set
for these extended characters would by default be the Windows character
set which is practically identical to ISO-8859-1 -- a character set
which in turn is incorporated into Unicode. But why would the program
need to care? It outputs to std::cout and what anyone does with that
output is their business.

Greg

Oct 12 '05 #4

P: n/a
* jalkadir:

So, my question about a program that will display some text on the
console, not a big deal, the only thing is that the text displayed will
have some character that are not ASCCI; like the letter 'o' with two
dots on it or the letter '=F1', (ALT-160/161/162, ETC). I don't have
much experience programming in MSW, thus I don't know how to handle
this problem.


Not strictly on-topic, but since it's a potential showstopper for newbies,
<url: http://home.no.net/dubjai/win32cpptut/html/w32cpptut_01_02_06.html>.

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Oct 12 '05 #5

P: n/a
That is not the case in my Win console, when the character '' is sent
to the tty it is not displayed as a '' (alt-164) but as another
(non-letter) character. That is because, as far as I was explained; the
console in WinXP cannot handle other chars than ASCCI. However, this is
not true, because if I type ALT-164 directly to the console the letter
'' is displayed.
If the win-console *does do its job as expected, when manually
inputting the data, as I explained above, then the problem exists
between the C++ code that is outputting data to the tty and the tty
itself, excuse the redundancy.

Well, thanks anyways, as I said in the original message; "Any help is
appreciated".

Oct 12 '05 #6

P: n/a

"jalkadir" <ja******@gosonic.ca> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
a question about one the most detestable operation
systems in the market,


Please keep your useless opinions off this newsgroup.

-Howard
Oct 12 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.