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 

Fill a void *

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





PostPosted: Mon Aug 22, 2005 1:10 pm    Post subject: Fill a void * Reply with quote



How can I fill a void *?
void *ptr;
//ptr= 00 00 00 20

thx


Back to top
Rudy Velthuis [TeamB]
Guest





PostPosted: Mon Aug 22, 2005 7:17 pm    Post subject: Re: Fill a void * Reply with quote



Grety wrote:

Quote:
How can I fill a void *?
void *ptr;
//ptr= 00 00 00 20

thx

You can't. A void* points to nothing in particular. To fill the memory
at that address with something, you'll need a typed pointer.
--
Rudy Velthuis [TeamB] http://rvelthuis.bei.t-online.de

"Argue for your limitations, and sure enough they're yours."
- Richard Bach

Back to top
Grety
Guest





PostPosted: Mon Aug 22, 2005 7:25 pm    Post subject: Re: Fill a void * Reply with quote



My problem is to write this value in Registry as a binary data string.
00 00 00 20
The function that I must use is MyReg->WriteBinaryData() which need void * !
Please guide me
thx again



"Rudy Velthuis [TeamB]" <velthuis (AT) gmail (DOT) com> wrote

Quote:
Grety wrote:

How can I fill a void *?
void *ptr;
//ptr= 00 00 00 20

thx

You can't. A void* points to nothing in particular. To fill the memory
at that address with something, you'll need a typed pointer.
--
Rudy Velthuis [TeamB] http://rvelthuis.bei.t-online.de

"Argue for your limitations, and sure enough they're yours."
- Richard Bach



Back to top
Rudy Velthuis [TeamB]
Guest





PostPosted: Mon Aug 22, 2005 7:29 pm    Post subject: Re: Fill a void * Reply with quote

Grety wrote:

Quote:
My problem is to write this value in Registry as a binary data string.
00 00 00 20
The function that I must use is MyReg->WriteBinaryData() which need
void * ! Please guide me

You'll have to cast, then. Use a pointer to something real (like int*)
and cast that to void* when passing to the routine.

--
Rudy Velthuis [TeamB] http://rvelthuis.bei.t-online.de

"Science is like sex: sometimes something useful comes out, but that is
not the reason we are doing it" -- Richard Feynman

Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Mon Aug 22, 2005 9:14 pm    Post subject: Re: Fill a void * Reply with quote


"Grety" <valid (AT) emailaddress (DOT) com> wrote


Quote:
My problem is to write this value in Registry as a binary data string.
00 00 00 20

You should as said so to begin with. The easiest way to do that is as
follows:

BYTE arr[4] = {0x00, 0x00, 0x00, 0x20};
MyReg->WriteBinaryData("TheValueName", arr, sizeof(arr));


Gambit



Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Mon Aug 22, 2005 9:14 pm    Post subject: Re: Fill a void * Reply with quote


"Rudy Velthuis [TeamB]" <velthuis (AT) gmail (DOT) com> wrote


Quote:
You'll have to cast, then.

Not true. See my other reply.


Gambit



Back to top
Rudy Velthuis [TeamB]
Guest





PostPosted: Mon Aug 22, 2005 9:14 pm    Post subject: Re: Fill a void * Reply with quote

Remy Lebeau (TeamB) wrote:

Quote:

"Rudy Velthuis [TeamB]" <velthuis (AT) gmail (DOT) com> wrote in message
news:xn0e6b4xo2mj1d9003xananews (AT) newsgroups (DOT) borland.com...

You'll have to cast, then.

Not true. See my other reply.

Ah, indeed.
--
Rudy Velthuis [TeamB] http://rvelthuis.bei.t-online.de

"I'm not going to have some reporters pawing through our papers.
We are the president." -- Hillary Clinton.

Back to top
liz
Guest





PostPosted: Tue Aug 23, 2005 1:08 am    Post subject: Re: Fill a void * Reply with quote

On Mon, 22 Aug 2005 17:40:42 +0430, Grety wrote:

Quote:
How can I fill a void *?
void *ptr;
//ptr= 00 00 00 20

you can't.

you can fill a buffer
--
liz

Back to top
Grety
Guest





PostPosted: Tue Aug 23, 2005 4:48 am    Post subject: Re: Fill a void * Reply with quote

My problem is solved now , thanks to all
"Grety" <valid (AT) emailaddress (DOT) com> wrote

Quote:
How can I fill a void *?
void *ptr;
//ptr= 00 00 00 20

thx





Back to top
Hendrik Schober
Guest





PostPosted: Tue Aug 23, 2005 10:11 am    Post subject: Re: Fill a void * Reply with quote

Remy Lebeau (TeamB) <no.spam (AT) no (DOT) spam.com> wrote:
Quote:
"Grety" <valid (AT) emailaddress (DOT) com> wrote in message
news:430a26c1 (AT) newsgroups (DOT) borland.com...

My problem is to write this value in Registry as a binary data string.
00 00 00 20

You should as said so to begin with. The easiest way to do that is as
follows:

BYTE arr[4] = {0x00, 0x00, 0x00, 0x20};
MyReg->WriteBinaryData("TheValueName", arr, sizeof(arr));

BTW, this works because
1. any array's identifier can be used where
a pointer to the array's first element is
needed and
2. any pointer can be converted to 'void*'.

Quote:
Gambit

Schobi

--
[email]SpamTrap (AT) gmx (DOT) de[/email] is never read
I'm Schobi at suespammers dot org

"Coming back to where you started is not the same as never leaving"
Terry Pratchett



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.