Unicode string

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dear c/g++ advanced programers:
 I copied and tried to test a piece simple code which is used for
(Hardcoding a Unicode String) from the book (
C++ Cookbook) by D. Ryan Stephens, Christopher Diggins, Jonathan
Turkanis, and Jeff Cogswell
at Chapter 13, Internationalization, section 1: Hardcoding a Unicode
String
example 13-1, it can compile and run on my g++4.5.2, but I don't quite
satisfy its result

--------------------
//Example 13-1 Hardcoding a Unicode string
#include <iostream>
#include <fstream>
#include <string>

using namespace std;

int main() {

 // Create some strings with Unicode characters
 wstring ws1 = L"Infinity: \u221E";
 wstring ws2 = L"Euro: \u0128";

 wchar_t w[] = L"Infinity: \u221E";

 wofstream out("tmp\\unicode.txt");
 out << ws2 << endl;
 wcout << ws2 << endl;
}


----------------------------------------------
root@eric-laptop:/home/eric/cppcookbook# ./a.out
Euro: ?
root@eric-laptop:/home/eric/cppcookbook# ls -l -a
total 56
drwxr-xr-x  2 eric eric 4096 2011-06-25 22:51 .
drwxr-xr-x 60 eric eric 4096 2011-06-25 22:51 ..
-rwxr-xr-x  1 root root 8666 2011-06-25 22:51 a.out
-rw-r--r--  1 eric eric 7372 2011-06-25 20:07 erreta
-rw-r--r--  1 eric eric  750 2011-05-21 09:38 example12-1.cpp
-rw-r--r--  1 eric eric  385 2011-06-25 22:51 example13-1.cpp
-rw-r--r--  1 eric eric  709 2011-06-25 21:12 example7-11.cpp
-rw-r--r--  1 eric eric  366 2011-06-25 20:02 example7-12.cpp
-rw-r--r--  1 eric eric  954 2011-06-25 19:02 example7-2.cpp
-rw-r--r--  1 eric eric  402 2011-06-01 20:55 example9-1.cpp
-rw-r--r--  1 root root    0 2011-06-25 22:51 tmp\unicode.txt
-rw-r--r--  1 eric eric  564 2011-06-25 19:00 utils.h
root@eric-laptop:/home/eric/cppcookbook#
---------------------------------------------------------------------------------------------
as you can see , it didn't output to file (tmp\unicode.txt) anything.
but it did output a little thing on screen.  Why is that? is that
suppose it should be on your system?
looking to see any advancer's help/hint/link and thanks a lot in
advance, Eric



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux