![]() |
output unicode to outfile
Dear c/g++ advanced programers or ubuntu-linux 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(ubuntu10.04 upgrade kernel to 2.6.35-25), but I don't quite satisfy its result -------------------- Code:
//Example 13-1 Hardcoding a Unicode stringroot@eric-laptop:/home/eric/cppcookbook# ./a.out Euro: EUR 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(size 0 and out.good() = 0). but it did output a little thing on screen. Why is that? is that suppose it should be on your system? according to book's author, this code is work under CodeWarrior(Metrowerk) aound 2006 It certainly have other way(some similar as vc++ 2005) can output unicode to file, but I like to know why this way is not work on my system. looking to see any advancer's help/hint/link and thanks a lot in advance, Eric, ericlin@fsshl.zzn.com, air0forceb914@aol.com |
Re: output unicode to outfile
You don't close the file, so maybe the data is lost on exit. Try explicitly closing the file after you've written to it.
|
Re: output unicode to outfile
Also putting a backslash in the middle of the name will make it tricky to access. Try just calling the file "unicode.txt", or if you meant "/tmp/unicode.txt" then don't try to do that with backslashes.
|
| All times are GMT +5.5. The time now is 10:59. |