 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
David Guest
|
Posted: Tue Mar 29, 2005 2:30 pm Post subject: TIniFile and No support for reading/writing an unsigned Inte |
|
|
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
|
Posted: Tue Mar 29, 2005 2:41 pm Post subject: Re: TIniFile and No support for reading/writing an unsigned |
|
|
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
|
Posted: Tue Mar 29, 2005 8:24 pm Post subject: Re: TIniFile and No support for reading/writing an unsigned |
|
|
"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 |
|
 |
|
|
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
|
|