home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / lang / c / 12416 < prev    next >
Encoding:
Text File  |  1992-08-16  |  1.3 KB  |  31 lines

  1. Newsgroups: comp.lang.c
  2. Path: sparky!uunet!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!ira.uka.de!math.fu-berlin.de!informatik.tu-muenchen.de!hphalle6!behrenss
  3. From: behrenss@Informatik.TU-Muenchen.DE (Soenke Behrens)
  4. Subject: Re: How do you connect all the records together?
  5. References: <lexier.714032180@sfu.ca>
  6. Sender: news@Informatik.TU-Muenchen.DE (USENET Newssystem)
  7. Organization: Technische Universitaet Muenchen, Germany
  8. Date: Mon, 17 Aug 1992 08:48:37 GMT
  9. Message-ID: <behrenss.714041317@hphalle6>
  10. Lines: 19
  11.  
  12. From your post, it was less than clear exactly how your datastructures
  13. or your code looked like. Nonetheless, here goes:
  14.  
  15. Have a pointer to your struct type, have a pointer to an array of pointers
  16. to your struct type. Now, everytime a record is to be inputed, malloc()
  17. memory for it, realloc() the memory in your array, store the pointer you
  18. got, input the struct. And so on.
  19.  
  20. When you want to output them: Simply look at all the stored pointers.
  21.  
  22. Easy enough. Really :) Write it down if you have trouble imagining it.
  23.  
  24. Soenke
  25.  
  26. -- 
  27. ===========================================================================
  28. More than silver, more than gold, I need   !    behrenss@informatik.
  29. electricity. I need it for my dreams.      !    tu-muenchen.de
  30. (RACTER)                                   !  FIDO: 2:246/13 Soenke Behrens
  31.