BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

TIniFile and No support for reading/writing an unsigned Inte

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Language C++)
View previous topic :: View next topic  
Author Message
David
Guest





PostPosted: Tue Mar 29, 2005 2:30 pm    Post subject: TIniFile and No support for reading/writing an unsigned Inte Reply with quote



Hello

How do you write an unsigned Integer to an Ini file when there is no support
for this, only for int's ?

Also if possible how would you write an unsigned integer to an Ini file in
hexadecimal notation instead of decimal ?

The only way I can see around this is to use the WriteString function and
convert from int to string etc.

Any better ideas ?

Thanx in advance
David


Back to top
Hans Galema
Guest





PostPosted: Tue Mar 29, 2005 2:41 pm    Post subject: Re: TIniFile and No support for reading/writing an unsigned Reply with quote



References: <42496696 (AT) newsgroups (DOT) borland.com>
In-Reply-To: <42496696 (AT) newsgroups (DOT) borland.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 129.125.201.248
Message-ID: <424969b5 (AT) newsgroups (DOT) borland.com>
X-Trace: newsgroups.borland.com 1112107445 129.125.201.248 (29 Mar 2005 06:44:05 -0800)
Lines: 12
Path: number1.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
Xref: number1.nntp.dca.giganews.com borland.public.cppbuilder.language.cpp:1002

David wrote:

Quote:
The only way I can see around this is to use the WriteString function and
convert from int to string etc.

Indeed. But then convert from unsigned int to string <g>.

Quote:
Any better ideas ?

No.

Hans.

Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Tue Mar 29, 2005 8:24 pm    Post subject: Re: TIniFile and No support for reading/writing an unsigned Reply with quote




"David" <davids (AT) unite (DOT) com.au> wrote


Quote:
How do you write an unsigned Integer to an Ini file when
there is no support for this, only for int's ?

Cast the value to a signed int and then you can use WriteInteger(). Just
remember to cast the value back to an unsigned int when calling
ReadInteger(). For example:

unsigned int i = ...;

Ini->WriteInteger("section", "value", (int)i);
//...
i = (unsigned int) Ini->ReadInteger("section", "value", 0);

Quote:
Also if possible how would you write an unsigned integer to
an Ini file in hexadecimal notation instead of decimal ?

Use IntToHex() with WriteString(), and then ReadString() with StrToInt().
For example:

unsigned int i = ...;

Ini->WriteString("section", "value", IntToHex((int)i));
//...
i = (unsigned int) StrToInt("0x" + Ini->ReadInteger("section", "value",
"00");


Gambit



Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Language C++) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.