Article View: borland.public.cppbuilder.internationalization
Article #750Need unicode help
From: Ulrich Lorenz
Date: Mon, 04 Mar 2002 10:07
Date: Mon, 04 Mar 2002 10:07
44 lines
2357 bytes
2357 bytes
Hi everyone,
I am going to program an application which uses a lot of ascii file I/O
using fopen, fprintf etc. What I need now is just one routine that provides
writing a unicode text file since this has to be interchanged with a Windows
CE device.
Have a look at the following snippet:
String s1 = "%s\n"; // terminating format
String s3 = "%s;"; // separation format string
String s2 = "This is the file header";
String s4 = "w";
filestring = DbPath + "xyz.txt";
wchar_t fmt[10], item[500], fmtField[10], filename[200], hd[300], rw[3];
StringToWideChar(s1, fmt, 10);
StringToWideChar(s3, fmtFeld, 10);
StringToWideChar(s2, hd, 300);
StringToWideChar(filestring, filename, 200);
if ((outfile = _wfopen(filename, rw)) == NULL)
{
Application->MessageBox(MesText->Strings[4].c_str(), "Something",
MB_OK);
return 0;
}
fwprintf(outfile, fmt, hd);
......followed by the block of data which is "fwprinted" to the file in
the same way.
So far, so good. But the resulting file doesn't have UNICODE characters,
it is pure ASCII.
Has anyone got a solution how to write a unicode text file with the standard
CPP methods??
I also would like to know whether it is possible to convert Strings directly
to UNICODE like it is with Visual C++ (The macro _T("string")).
Thanks,
Ulrich
Technical Details
Message-ID:
<3c834765_1@dnews>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!sienna.impulse.net!nntp-relay.ihug.net!out.nntp.be!propagator-SanJose!in.nntp.be!newsfeed01.tsnz.net!newsfeeds.ihug.co.nz!ihug.co.nz!dnewsShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10297d,d681e9661591b8f6,start X-Google-Attributes: gid10297d,public X-Google-ArrivalTime: 2002-03-04 02:10:20 PST Reply-To: "Ulrich Lorenz" <ulrich.lorenz@eds.com> From: "Ulrich Lorenz" <ulrich.lorenz@eds.com> Newsgroups: borland.public.cppbuilder.internationalization Subject: Need unicode help Date: Mon, 4 Mar 2002 11:07:05 +0100 Lines: 51 Organization: EDS PLM solutions X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2919.6700 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700 NNTP-Posting-Host: 134.244.134.89 Message-ID: <3c834765_1@dnews> X-Trace: dnews 1015236453 134.244.134.89 (4 Mar 2002 02:07:33 -0800) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!sienna.impulse.net!nntp-relay.ihug.net!out.nntp.be!propagator-SanJose!in.nntp.be!newsfeed01.tsnz.net!newsfeeds.ihug.co.nz!ihug.co.nz!dnews