|
Boost Users : |
Subject: Re: [Boost-users] Unicode Problem
From: John Dlugosz (JDlugosz_at_[hidden])
Date: 2010-04-19 18:02:30
My guess is that the encoding of the file system is set up differently. It needs to match the encoding of the string literals in the C++ source files (and the text editor) to work as expected.
In general, you need to translate the encoding from what the program literals or strings have into what the file system is using.
> -----Original Message-----
> From: boost-users-bounces_at_[hidden] [mailto:boost-users-
> bounces_at_[hidden]] On Behalf Of green beret
> Sent: Monday, April 19, 2010 10:12 AM
> To: boost-users_at_[hidden]
> Subject: [Boost-users] Unicode Problem
>
> Ive written a small function to copy a directory from one dir to
> another
>
> When I run this on one Fedora 12 machine, it works fine, even for
> chinese files and folders.
>
> however, when i run this on Fedora 12 on another machine, it gives me
> Boost::filesystem::copy_file: Invalid Argument: "/mnt/pd1/??Microsoft
> Word ??.doc"."/mnt/pd/??Microsoft Word ??.doc"
>
> Why? is the machine missing any package? Please help
> Here is the code:
>
> #include <iostream>
> #include <boost/filesystem.hpp>
> #include <cstdio>
> #include <string>
>
> using namespace std;
>
> struct dir
> {
> int file_count;
> int total_size;
> };
>
>
> void copy_dir(string src, string dest);
>
> int main()
> {
>
> copy_dir("/media/disk", "/media/disk-1");
>
> return 0;
> }
>
> void copy_dir(string src, string dest)
> {
>
> boost::filesystem::path psrc(src);
> boost::filesystem::path pdest(dest);
>
> if(!boost::filesystem::is_directory(psrc) ||
> !boost::filesystem::is_directory(pdest))
> { cerr<<" Source and Destination are not directories "<<endl; }
>
> for(boost::filesystem::directory_iterator i(psrc);
> i!=boost::filesystem::directory_iterator(); ++i)
> {
> boost::filesystem::path from(*i);
> string to_path=pdest.string() + "/" + i->leaf();
> boost::filesystem::path to(to_path);
>
> if(is_regular(from) && !boost::filesystem::exists(to) )
> {
> cerr<<"Copying "<<from.string()<<" to "<<to.string()<<endl;
> copy_file(from,to);
> }
> else if(is_directory(from) )
> {
> if(!exists(to))
> create_directory(to);
> copy_dir(from.string(), to_path);
> }
> }
>
> }
>
>
>
> Thanks...
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
TradeStation Group, Inc. is a publicly-traded holding company (NASDAQ GS: TRAD) of three operating subsidiaries, TradeStation Securities, Inc. (Member NYSE, FINRA, SIPC and NFA), TradeStation Technologies, Inc., a trading software and subscription company, and TradeStation Europe Limited, a United Kingdom, FSA-authorized introducing brokerage firm. None of these companies provides trading or investment advice, recommendations or endorsements of any kind. The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer.
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net