Read-only archive of the All About Symbian forum (2001–2013) · About this archive

TBuf Comparing!!!

0 replies · 1,456 views · Started 05 April 2006

Hi all,
I just want to compare the IMEI which I have retrieved with a text file content.
I retrieve the IMEI in this way:

TBuf16<20> bufIMEI;
bufIMEI.Zero();
TPlpVariantMachineId imei;
PlpVariant::GetMachineIdL(imei);
bufIMEI.Copy(imei);

the bufIMEI is a TBuf16, and I read the file content in this way:

RFile aFile;
RFs mySession;
mySession.Connect();
if(aFile.Open(mySession, KFileIMEIName, EFileRead) == KErrNone)
{
TFileText fileText;
fileText.Set(aFile);
if(fileText.Seek(ESeekStart) == KErrNone)
{
if(fileText.Read(iBufIMEIContent) == KErrNone)
{
}
}
aFile.Close();
}
mySession.Close();

wherese the iBufIMEIContent is a TBuf16, too.

I want to compare the iBufIMEIContent and bufIMEI,
but the length of these two variable are not same.
the bufIMEI is in 2 bytes format, and the iBufIMEIContent is in ANSI format

I saw the two contents in a hes editor:
the result:

the bufIMEI: 33 00 35 00 36 00
the iBufIMEIContent: 33 35 36

how can I convert these two values to each other and do a comparison?!!
I've also read the "Conversion bitween 8 and 16 bits descriptors " topic in newlc forum, but it couldn't solve this problem!

Thank you