Need some help with dereferencing structures and such

From: Andrew Falanga (andy_at_spam.me.not)
Date: 01/31/04


Date: Sat, 31 Jan 2004 02:47:56 -0700

Hi there everybody,

Wow, it's been a while since I've posted to this NG. Ok, now to the point.

I'm rewriting my last class project to expand my understanding of C and will eventually re-write it in C++. There is a structure defined as:

struct products {
  char UPC[13];
  char DESC[20];
  float PRICE;
  float DISC;
  char TAX;
  struct products* prev;
  struct products* next;
};

As you can tell, by the the pointer types in the structure definition, I'm trying to create a doublely linked list. Now, I have a function called accessData(). This function is what will be responsible for reading the products "database" from disk and creating the linked list.

The accessData function is prototyped liked this;

int accessData(void* p, FILE* dataIn);

I was trying to take advantage of the void pointer here. However, I'm aparently missing something because every time I try to compile my driver program (to see if I've coded the accessData function right) the compiler complains something to the effect of, "prev not a member of structure or union." It has this problem when encountering lines like this:

p->prev = temp; // temp is a temp holder created in the function

What's wrong? If more is needed, I'll see what I can do. The source code isn't actually on the computer I'm writing this message from.

Andy

-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----