home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / unix / question / 15893 < prev    next >
Encoding:
Internet Message Format  |  1993-01-24  |  1.5 KB

  1. Path: sparky!uunet!zaphod.mps.ohio-state.edu!moe.ksu.ksu.edu!phys.ksu.edu!rjq
  2. From: rjq@phys.ksu.edu (Rob Quinn)
  3. Newsgroups: comp.unix.questions
  4. Subject: Re: question on fscanf
  5. Date: 24 Jan 1993 11:06:27 GMT
  6. Organization: Kansas State University
  7. Lines: 27
  8. Message-ID: <1jtt7jINNgj1@moe.ksu.ksu.edu>
  9. References: <1993Jan22.180730.1@vax1.umkc.edu>
  10. NNTP-Posting-Host: bohr.phys.ksu.edu
  11.  
  12. In <1993Jan22.180730.1@vax1.umkc.edu> srinivasan@vax1.umkc.edu writes:
  13.  
  14.  Mail to you bounced. 
  15.  
  16. In comp.unix.questions you write:
  17. >       Thanks a lot for  all the people who responded to my question.
  18. >I am rephrasing the question now since i found that the fopen command
  19. >si returning a valid pointer but when i do a fscanf on the file utmp
  20. >(path = /etc/utmp) then it gives a segmentation fault. Can someone 
  21. >explain this phenemenon.
  22.  
  23.  Yes, your program is broken.
  24.  What more can we say with what you have given?
  25.  
  26. >thank you
  27.  
  28.  But, some ideas. When I do a 'wc -l' on my /etc/utmp I see that
  29. it has 0 lines. That means there's no terminating \n. utmp is a
  30. binary file. What do you expect to be able to scan out of it?
  31. I would bet you are scanning some huge string into a small array.
  32. Did you look at the utmp man page? If I were scanning utmp, I would
  33. use open/read/close rather than stdio.
  34.  
  35. --
  36. |                                                                   Rob Quinn |
  37. |                                                            rjq@phys.ksu.edu |
  38. |                                                       QuinnBob@KSUVM.BITNET |
  39.