473,406 Members | 2,377 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

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

Oct 12 '05 #1
6 1350
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
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
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
* 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
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

"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

22
by: Max M | last post by:
There is a story today on Slashdot Open Source Project Management Lessons ======================================...
77
by: nospam | last post by:
Reasons for a 3-tier achitecture for the WEB? (NOTE: I said, WEB, NOT WINDOWS. DON'T shoot your mouth off if you don't understand the difference.) I hear only one reason and that's to switch a...
35
by: wired | last post by:
Hi, I've just taught myself C++, so I haven't learnt much about style or the like from any single source, and I'm quite styleless as a result. But at the same time, I really want nice code and I...
125
by: Sarah Tanembaum | last post by:
Beside its an opensource and supported by community, what's the fundamental differences between PostgreSQL and those high-price commercial database (and some are bloated such as Oracle) from...
6
by: Dovelet | last post by:
Hi all, I would like to write DOS program to change the MS Windows Sound Recording source. When I run it with the parameter, it will change the recording source as follow: C:\> abc.exe...
50
by: Joseph Casey | last post by:
Greetings. I have read that the mistake of calling free(some_ptr) twice on malloc(some_data) can cause program malfunction. Why is this? With thanks. Joseph Casey.
0
by: Joel | last post by:
Long and rambling question, here -- we have a customer with a database that is outgrowing their original storage, and they want to upgrade storage as cheaply and smoothly as possible. Presently,...
3
by: Frank Millman | last post by:
Hi all I am writing a business/accounting application. Once a user has logged in they are presented with a menu. Each menu option has a description and an associated file name and program name....
6
by: DanielJohnson | last post by:
int main() { printf("\n Hello World"); main; return 0; } This program terminate just after one loop while the second program goes on infinitely untill segmentation fault (core dumped) on...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.