Casting diff structures to char*
Robert Angelino
robert at nereid.jpl.nasa.gov
Mon May 13 12:33:33 AEST 1991
I've written a function that takes a char* pointer to different
structs that have a common named var (which I'm accessing in this
function). I've included an example.
struct one
{
int a,
rnum;
};
struct two
{
char b;
int a,
rnum;
};
my_func(rec,...)
char *is_this_correct;
.
.
.
{
is_this_correct->rnum = ...
}
my_func((char*) &a,...);
my_func((char*) &b,...);
This is the error I'm getting
"nonunique name demands struct/union or struct/union pointer".
I keep getting this error in my_func where I try to access rec->rnum.
Am I doing this correctly??
Thanks in advance and any suggestions are welcome.
--
- ------ - Robert Angelino
| | | ---- \ | | ms T-1704L
| | | | \ | | | 4800 Oak Grove Drive
| | | | -- | | | Pasadena, CA 91109
---| | | | \__/ | |___ robert at triton.jpl.nasa.gov
\____|et |_|ropulsion |_____\aboratory (818) 354-9574
More information about the Comp.lang.c
mailing list