I/O with Spanish words

S

solartimba

I need to read Spanish words from a file and print them to the screen.
Is there a C++ header file that allows foreign words? Is the problem
C or the OS? (I am the only person that will use this program)
 
J

Julie

solartimba said:
I need to read Spanish words from a file and print them to the screen.
Is there a C++ header file that allows foreign words? Is the problem
C or the OS? (I am the only person that will use this program)

There is nothing special that you need to do -- the i/o stream has no concept
of language.

The consideration is on the character type (ASCII 8-bit, UNICODE 16-bit, et
alii). If the input characters are ASCII, the 'default' input/output handlers
will work just fine, however if you are using UNICODE, you will need to use the
wide-character versions.

However, your post isn't entirely clear -- are you inquiring about
foreign-language versions of the libraries themselves? Something like
"is_open()" becomes "es_abierto()" (or whatever the Spanish equivalent is)?
 
P

Phlip

solartimba said:
I need to read Spanish words from a file and print them to the screen.
Is there a C++ header file that allows foreign words? Is the problem
C or the OS? (I am the only person that will use this program)

What problem are you having?

At a guess, your "screen" is your console, which uses a different character
set than MS Windows proper (or similar GUIs). The Desktop uses ISO 8859-1
Latin, where most Spanish is written, and the console (or "Command Prompt")
uses IBM Code Page 437. Here's my console's mode:

Status for device CON:
----------------------
Lines: 300
Columns: 120
Keyboard rate: 31
Keyboard delay: 1
Code page: 437

A forum that discusses internationalization will know how to the 'mode'
command built-into CMD.EXE to change the code page. This is probably a
frequently asked question, so start with Google.
 
R

Robbie Hatley

Phlip said:
What problem are you having?

At a guess, your "screen" is your console, which uses a different character
set than MS Windows proper (or similar GUIs). The Desktop uses ISO 8859-1
Latin, where most Spanish is written, and the console (or "Command Prompt")
uses IBM Code Page 437. Here's my console's mode:


Status for device CON:
----------------------
Lines: 300
Columns: 120
Keyboard rate: 31
Keyboard delay: 1
Code page: 437

A forum that discusses internationalization will know how to the 'mode'
command built-into CMD.EXE to change the code page....

The CHCP command will change code pages. Code page 850 is
"Multi-lingual (Latin 1)", so this should give the desired result:

CHCP 850

--
Cheers,
Robbie Hatley
Tustin, CA, USA
email: lonewolfintj at pacbell dot net
web: home dot pacbell dot net slant earnur slant
 
S

solartimba

I guess I should have been more specific. How do I make the program
below have the proper output on the accented character?

************************************

#include <iostream>
#include <string>

using namespace std;



int main()
{

string question1("Esciba una oración: ");

cout << endl << question1 << endl;

return 0;

} //end main()

**********************************************

This is only two lines from the actual program, but I am hoping that
the solution will apply to reading txt files and outputting them to
the console as well.
 
P

Phlip

solartimba said:
I guess I should have been more specific. How do I make the program
below have the proper output on the accented character?

Please read the welcome message for this newsgroup:

http://www.slack.net/~shiva/welcome.txt

Your question still is not complete. What bad effect do you see when
"oración" comes out of your program? Is it output into a console?

If your program were called main.exe, and if you enter...

main.exe >scratch.txt
notepad scratch.txt

What do you see? Is it different or the same?
 
?

=?ISO-8859-15?Q?Juli=E1n?= Albo

solartimba said:
I guess I should have been more specific. How do I make the program
below have the proper output on the accented character?

************************************

#include <iostream>
#include <string>

using namespace std;



int main()
{

string question1("Esciba una oración: ");

Windows fonts do not use habitually the OEM charset that is used in console
mode. Change the font used in the editor, or write that part of the program
with a ms-dos editor.
 
J

josh

Robbie said:
The CHCP command will change code pages. Code page 850 is
"Multi-lingual (Latin 1)", so this should give the desired result:

CHCP 850

850 is equivalent to "DOS: Western Europe" in charmap.
1252 is equivalent to "Windows: Western", which is more likely what GUI
stuff is using. (it's also pretty close to ISO-8859-1)

So I'd suggest:

CHCP 1252

-josh
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,169
Messages
2,570,920
Members
47,464
Latest member
Bobbylenly

Latest Threads

Top