home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / lang / c / 16117 < prev    next >
Encoding:
Internet Message Format  |  1992-11-08  |  1.4 KB

  1. Path: sparky!uunet!ogicse!uwm.edu!caen!saimiri.primate.wisc.edu!nntp.msstate.edu!Ra.MsState.Edu!cee1
  2. From: cee1@Ra.MsState.Edu (Charles Evans)
  3. Newsgroups: comp.lang.c
  4. Subject: Need help reading floats from file
  5. Message-ID: <cee1.721108743@Ra.MsState.Edu>
  6. Date: 7 Nov 92 03:59:03 GMT
  7. Article-I.D.: Ra.cee1.721108743
  8. Sender: news@ra.msstate.edu
  9. Organization: Mississippi State University
  10. Lines: 33
  11. Nntp-Posting-Host: ra.msstate.edu
  12.  
  13. Ok, in getting data for an experiment to look at, I have
  14. 200 .xx floating point number, just a decimal point and 2 decimal
  15. places, put in 20 x 20 in a data file.
  16.  
  17. How can I read them into an array.. all i could think of was do 
  18. a HUGE fgets/sscanf thing with "%f %f ... %f".. 20 times and put into
  19. 20 parts of an array like : value[i++][j] on an on until i=20 then
  20. reset i and increment j..
  21.  
  22. but i get weird errors from dos and qemm.. something is wrong.
  23. why cant i (i can in basic :)) just keep reading in a floating point number
  24. or read it in as a small string until the first whitespace?
  25.  
  26. or something. thanks
  27.  
  28.  
  29. data file looks like:
  30.  
  31. .11 .33 .00 .......
  32. .23 .45 .23 .......
  33.  .   .   .
  34.  .   .   .
  35.  
  36. 20 x 20
  37.  
  38. thanks
  39. chuck
  40.  
  41. --
  42. +--------------------+-----------------------+------------------------+
  43. |  Charles E. Evans  |  cee1@ra.msstate.edu  |        Fear God        |
  44. |    iDLE CHATTEr    |  cee1@MSSTATE.BITNET  |  Love the brotherhood  |
  45. |    Idle chatteR    |cevans@abe.msstate.edu |  Pray without ceasing  | 
  46.