Mail Archives: djgpp/1998/01/26/22:01:18
From: | Vic <tudor AT cam DOT org>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | HELP: accessing astructure members via VOID pointer??
|
Date: | Mon, 26 Jan 1998 21:29:21 -0500
|
Organization: | Communications Accessibles Montreal, Quebec Canada
|
Lines: | 11
|
Message-ID: | <34CD4681.3747@cam.org>
|
NNTP-Posting-Host: | dialup-202.hip.cam.org
|
Mime-Version: | 1.0
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Hello. I'd like to be able to do something like this:
I have a struct foo (int x,y,z) and a void* bar=&foo;
So bar holds the adress of foo. I know that at the beginning of the
struct lies the first member. so why can't I just say *bar=55 or
something?
I'd like to be able to access any member of a struct using a pointer.
Like, if I want to access the second member, I add 4(or whatever) to the
pointer and write the value to that adress. How could I do that? HELP!!
TIA,
--
--> http://www.cam.org/~tudor <--
- Raw text -