wchar_t

G

Gaijinco

I'm from Colombia a country where we speak spanish. I had always used
char's and the standard functions for I/O and other matters that had to
deal with characters.

However today I tried to use some things with wchar_t with poor
results.

The first problem is that there is almost none documentation. I checked
books from Deitel & Deitel, O'Reilly, Sam, Addison Wesley but none had
anything about wchar_t. I tried google but then again there was nothing
really useful and the information I found was a little inacurate as I
tried to compile programs with it.

Does someone knows of a good source of information? Does have anyone
used wchar_t and survived?

Thanks a lot.
 
M

Mike Wahler

Gaijinco said:
I'm from Colombia a country where we speak spanish. I had always used
char's and the standard functions for I/O and other matters that had to
deal with characters.

However today I tried to use some things with wchar_t with poor
results.

The first problem is that there is almost none documentation. I checked
books from Deitel & Deitel, O'Reilly, Sam, Addison Wesley but none had
anything about wchar_t. I tried google but then again there was nothing
really useful and the information I found was a little inacurate as I
tried to compile programs with it.

Does someone knows of a good source of information? Does have anyone
used wchar_t and survived?

Exactly what did you try to do with type 'wchar_t'?
What results did you expect, what results did you
get, and what was the difference?

-Mike
 
G

Gaijinco

For starters I'm trying to print "Ahí está el problema"

It was supposed to be along the lines of:

#include <wchar.h>
#include <iostream>
using namespace std;

int main()
{
wcout << L"Ahí está el problema";
return 0;
}

But the compiler says it doesn't find "wcout".
 
M

Mike Wahler

Gaijinco said:
For starters I'm trying to print "Ahí está el problema"

First note that the 'wide character' type (wchar_t)
is not specified by C++ to include all of the
characters in your string literal above. Your
operating system and/or implementation must provide
that.
It was supposed to be along the lines of:
#include <wchar.h>

You don't need this header in C++, where 'wchar_t' is
a keyword (i.e. it's a built-in type).
#include <iostream>

This header declares the standard built-in stream objects,
including the 'wide stream' objects such as 'std::wcout'.
using namespace std;
int main()
{
wcout << L"Ahí está el problema";
return 0;
}
But the compiler says it doesn't find "wcout".

Therefore your compiler does not conform to the
C++ standard. Try a different compiler (or perhaps
a more current version of the one you're using).

-Mike
 

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

No members online now.

Forum statistics

Threads
473,999
Messages
2,570,243
Members
46,836
Latest member
login dogas

Latest Threads

Top