home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / lang / c / 19148 < prev    next >
Encoding:
Internet Message Format  |  1993-01-03  |  1.5 KB

  1. Path: sparky!uunet!van-bc!tradent!lord
  2. From: lord@tradent.wimsey.bc.ca (Jason Cooper)
  3. Newsgroups: comp.lang.c
  4. Subject: ** HELP WITH FILE I/O **
  5. Message-ID: <JmeswB1w165w@tradent.wimsey.bc.ca>
  6. Date: Sat, 02 Jan 93 22:02:18 PST
  7. Organization: TradeNET International Trade Corp.
  8. Lines: 26
  9.  
  10. Eeek!  I am writing a program to handle a local track meet and have to 
  11. input the participant records from a file.  What I want to do is load 
  12. these into an array for quick and easy access.  The array is right now of 
  13. undefined length, and its elements are structures (including each event, 
  14. it's heat, it's event, etc.).  I've tried using:
  15.  
  16. fread(meet[record], sizeof(struct meetstruct), 1, tfile)
  17.  
  18. Where meet is the array, meetstruct is the structure the array is 
  19. composed of, and tfile is the track meet's file stream.  I don't know 
  20. _what_ I'm doing wrong, but if somebody could correct this (oops, forgot 
  21. to mention, that's in a loop to go through records, I tried taking the 
  22. whole thing in one, but that didn't work either), then I'd appreciate 
  23. that VERY MUCH.  If I could input the whole thing in one with fread or 
  24. something, that would be _WONDERFUL_.  I'm using Borland C++, and would 
  25. like to understand _what_ I'm doing, so if you could explain it too, that 
  26. would be nice.  If I have to limit the size of the array, that's doable 
  27. too.
  28.  
  29.                                                 Jason Cooper
  30.  
  31. Oh, and, since I'm being less-than-coherent, if you think you can help me 
  32. but are not sure, PLEASE send me private mail...
  33.  
  34. /d
  35. (oops)
  36.