[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Fastcgipp-users] A basic C++ question probably
From: |
Eddie Carle |
Subject: |
Re: [Fastcgipp-users] A basic C++ question probably |
Date: |
Fri, 27 Nov 2009 23:40:54 -0700 |
On Sat, 2009-11-28 at 16:36 +1030, address@hidden wrote:
> fin.open("default");
> }
>
> wchar_t ch;
> while (fin.get(ch)) {
> out << ch;
> }
> fin.close();
Just a not that this little nugget of code could be expedited with a
convenient little helper function in the Fcgistream class. Check out the
dump function in...
http://www.nongnu.org/fastcgipp/doc/2.0beta/classFastcgipp_1_1Fcgistream.html
> std::wifstream fin;
> if (environment.queryString.size > 0) {
> std::string incfile = environment.queryString;
> }
> else {
> std::string incfile = "default";
> }
>
> fin.open(incfile.c_str);
I'm going to assume this is where all your hassle is coming from. You
are entering into a realm of the C++ language that few have ventured
into. Locales, wide characters and code conversion is a bizarre side of
the standard library. You'll have trouble finding people who have
experience with it.
If you don't really need Unicode support in this application at this
point I would suggest dumping all the wchar_t and wstring stuff from it.
Everything is templated to work perfectly well with normal characters.
Change your class Echo: public Fastcgipp::Request<wchar_t> declaration
to class Echo: public Fastcgipp::Request<char> and get rid of all your
references to wchar_t and wstring. Things will then start working more
as you would expect them to.
If you want to work with the code conversion stuff and so on I would
check out Langer and Kreft "Standard C++ Iostreams and Locales".
Otherwise it's a tad too complicated to delve into in on a mailing list.
Good luck :)
--
Eddie Carle
This message has been signed with an RFC4880 signature. It is
guaranteed to have originated from Eddie Carle and its contents
can be validated against its signature.
signature.asc
Description: This is a digitally signed message part