A question about my C++ program and MSWindows :) | | |
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 | | | | re: A question about my C++ program and MSWindows :)
jalkadir wrote:[color=blue]
> ...
> 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.[/color]
Try this.
#include <stdio.h>
#include <stdlib.h>
int main()
{
system("chcp 437 > nul");
printf("%c %c %c \n", 160, 161, 162);
return 0;
}
[color=blue]
> ...[/color] | | | | re: A question about my C++ program and MSWindows :)
jalkadir wrote:[color=blue]
> 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
>[/color]
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 | | | | re: A question about my C++ program and MSWindows :)
jalkadir wrote:[color=blue]
> 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[/color]
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 | | | | re: A question about my C++ program and MSWindows :)
* jalkadir:[color=blue]
>
> 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.[/color]
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? | | | | re: A question about my C++ program and MSWindows :)
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". | | | | re: A question about my C++ program and MSWindows :)
"jalkadir" <jalkadir@gosonic.ca> wrote in message
news:1129087759.922805.152530@g14g2000cwa.googlegr oups.com...
[color=blue]
> a question about one the most detestable operation
> systems in the market,[/color]
Please keep your useless opinions off this newsgroup.
-Howard |  | | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 226,411 network members.
|