Board index » cppbuilder » Fill a void *

Fill a void *


2005-08-22 09:10:42 PM
cppbuilder55
How can I fill a void *?
void *ptr;
//ptr= 00 00 00 20
thx
 
 

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] rvelthuis.bei.t-online.de
"Argue for your limitations, and sure enough they're yours."
- Richard Bach
 

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]" < XXXX@XXXXX.COM >wrote in message
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] rvelthuis.bei.t-online.de

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

{smallsort}

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] 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
 

Re:Fill a void *

"Grety" < XXXX@XXXXX.COM >wrote in message
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
 

Re:Fill a void *

"Rudy Velthuis [TeamB]" < XXXX@XXXXX.COM >wrote in message
Quote
You'll have to cast, then.
Not true. See my other reply.
Gambit
 

Re:Fill a void *

Remy Lebeau (TeamB) wrote:
Quote

"Rudy Velthuis [TeamB]" < XXXX@XXXXX.COM >wrote in message
news: XXXX@XXXXX.COM ...

>You'll have to cast, then.

Not true. See my other reply.
Ah, indeed.
--
Rudy Velthuis [TeamB] rvelthuis.bei.t-online.de
"I'm not going to have some reporters pawing through our papers.
We are the president." -- Hillary Clinton.
 

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
 

Re:Fill a void *

My problem is solved now , thanks to all
"Grety" < XXXX@XXXXX.COM >wrote in message
Quote
How can I fill a void *?
void *ptr;
//ptr= 00 00 00 20

thx


 

Re:Fill a void *

Remy Lebeau (TeamB) < XXXX@XXXXX.COM >wrote:
Quote
"Grety" < XXXX@XXXXX.COM >wrote in message
news: XXXX@XXXXX.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
--
XXXX@XXXXX.COM 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