| View previous topic :: View next topic |
| Author |
Message |
Grety Guest
|
Posted: Mon Aug 22, 2005 1:10 pm Post subject: Fill a void * |
|
|
How can I fill a void *?
void *ptr;
//ptr= 00 00 00 20
thx
|
|
| Back to top |
|
 |
Rudy Velthuis [TeamB] Guest
|
Posted: Mon Aug 22, 2005 7:17 pm Post subject: Re: Fill a void * |
|
|
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
|
Posted: Mon Aug 22, 2005 7:25 pm Post subject: Re: Fill a void * |
|
|
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
|
Posted: Mon Aug 22, 2005 7:29 pm Post subject: Re: Fill a void * |
|
|
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
|
Posted: Mon Aug 22, 2005 9:14 pm Post subject: Re: Fill a void * |
|
|
"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
|
Posted: Mon Aug 22, 2005 9:14 pm Post subject: Re: Fill a void * |
|
|
"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
|
Posted: Mon Aug 22, 2005 9:14 pm Post subject: Re: Fill a void * |
|
|
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
|
Posted: Tue Aug 23, 2005 1:08 am Post subject: Re: Fill a void * |
|
|
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
|
Posted: Tue Aug 23, 2005 4:48 am Post subject: Re: Fill a void * |
|
|
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
|
Posted: Tue Aug 23, 2005 10:11 am Post subject: Re: Fill a void * |
|
|
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*'.
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 |
|
 |
|