Article View: borland.public.cppbuilder.nativeapi
Article #17248Re: Converting unicode hex digits
From: Remy Lebeau (TeamB)
Date: Mon, 31 Mar 2003 20:09
Date: Mon, 31 Mar 2003 20:09
52 lines
2870 bytes
2870 bytes
"Amer Alhabsi" <alhabsiNOSPAM@squ.edu.om> wrote in message
news:3e88906b@newsgroups.borland.com...
> This exports outlook express data into a text file. What
> I'm interested in is the value of "store root" which represents
> the folder outlook express stores data.
What OS are you running under? I assume WinNT/2K/XP? On my Win98 machine,
the "Store Root" value is a simple ASCII string:
"Store Root"="F:\\Program Files\\Internet Mail and News\\Gambit"
For what you're asking, you'll have to manually parse the string into its
individual digits, and then you can use StrToInt() to convert the strnigs in
actual numeric values and then cast them to wchar_t as needed. For example
(untested; error handling ommited for simplicity):
AnsiString asStoreRoot = extract "Store Root" value from file;
WideString wStoreRoot;
if( asStoreRoot.SubString(1, 3) != "hex" )
wStoreRoot = asStoreRoot;
else
{
// remove "hex" prefix...
int pos = asStoreRoot.Pos(":");
if( pos != 0 ) asStoreRoot.Delete(1, pos);
// strip off "\", spaces, and line breaks...
TReplaceFlags flags = TReplaceFlags() << rfReplaceAll
asStoreRoot = StringReplace(asStoreRoot, "\\", "", flags);
asStoreRoot = StringReplace(asStoreRoot, "\r\n", "", flags);
asStoreRoot = StringReplace(asStoreRoot, " ", "", flags);
// tokenize the digits...
TStringList *digits = new TStringList;
digits->CommaText = asStoreRoot.Trim();
wStoreRoot.SetLength(digits->Count);
// convert the digits...
for(int x = 0; x < digits->Count; x++)
wStoreRoot[x] = (wchar_t) StrToInt("0x" + digits->Strings[x]);
// cleanup
delete digits;
}
// use wStoreRoot as needed...
Gambit
Technical Details
Message-ID:
<3e88a08e$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-06!sn-xit-09!supernews.com!iad-peer.news.verio.net!news.verio.net!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mailReferences:
<3e8872e8@newsgroups.borland.com> <3e887aae$1@newsgroups.borland.com> <3e88906b@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,8cdb98848d855eac X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-03-31 12:16:02 PST From: "Remy Lebeau \(TeamB\)" <gambit47@yahoo.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <3e8872e8@newsgroups.borland.com> <3e887aae$1@newsgroups.borland.com> <3e88906b@newsgroups.borland.com> Subject: Re: Converting unicode hex digits Date: Mon, 31 Mar 2003 12:09:51 -0800 Lines: 54 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 NNTP-Posting-Host: 207.175.226.26 Message-ID: <3e88a08e$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1049141390 207.175.226.26 (31 Mar 2003 12:09:50 -0800) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-06!sn-xit-09!supernews.com!iad-peer.news.verio.net!news.verio.net!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail